/* A Bison parser, made by GNU Bison 3.5.1.  */

/* Bison implementation for Yacc-like parsers in C

   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
   Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

/* C LALR(1) parser skeleton written by Richard Stallman, by
   simplifying the original so-called "semantic" parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Undocumented macros, especially those whose name start with YY_,
   are private implementation details.  Do not rely on them.  */

/* Identify Bison output.  */
#define YYBISON 1

/* Bison version.  */
#define YYBISON_VERSION "3.5.1"

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 2

/* Push parsers.  */
#define YYPUSH 0

/* Pull parsers.  */
#define YYPULL 1

/* Substitute the type names.  */
#define YYSTYPE         HSQL_STYPE
#define YYLTYPE         HSQL_LTYPE
/* Substitute the variable and function names.  */
#define yyparse         hsql_parse
#define yylex           hsql_lex
#define yyerror         hsql_error
#define yydebug         hsql_debug
#define yynerrs         hsql_nerrs

/* First part of user prologue.  */
#line 2 "bison_parser.y"


/**
 * bison_parser.y
 * defines bison_parser.h
 * outputs bison_parser.c
 *
 * Grammar File Spec: http://dinosaur.compilertools.net/bison/bison_6.html
 *
 */
/*********************************
 ** Section 1: C Declarations
 *********************************/

// clang-format on
#include <kmsql/sql/parser/bison_parser.h>
#include <kmsql/sql/parser/flex_lexer.h>

#include <stdio.h>
#include <string.h>

  using namespace kmsql;

  int yyerror(YYLTYPE * llocp, SQLParserResult * result, yyscan_t scanner, const char* msg) {
    result->setIsValid(false);
    result->setErrorDetails(strdup(msg), llocp->first_line, llocp->first_column);
    return 0;
  }
  // clang-format off

#line 108 "bison_parser.cc"

# ifndef YY_CAST
#  ifdef __cplusplus
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
#  else
#   define YY_CAST(Type, Val) ((Type) (Val))
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
#  endif
# endif
# ifndef YY_NULLPTR
#  if defined __cplusplus
#   if 201103L <= __cplusplus
#    define YY_NULLPTR nullptr
#   else
#    define YY_NULLPTR 0
#   endif
#  else
#   define YY_NULLPTR ((void*)0)
#  endif
# endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 1
#endif

/* Use api.header.include to #include this header
   instead of duplicating it here.  */
#ifndef YY_HSQL_BISON_PARSER_H_INCLUDED
# define YY_HSQL_BISON_PARSER_H_INCLUDED
/* Debug traces.  */
#ifndef HSQL_DEBUG
# if defined YYDEBUG
#if YYDEBUG
#   define HSQL_DEBUG 1
#  else
#   define HSQL_DEBUG 0
#  endif
# else /* ! defined YYDEBUG */
#  define HSQL_DEBUG 0
# endif /* ! defined YYDEBUG */
#endif  /* ! defined HSQL_DEBUG */
#if HSQL_DEBUG
extern int hsql_debug;
#endif
/* "%code requires" blocks.  */
#line 39 "bison_parser.y"

// %code requires block

#include <kmsql/sql/parser_result.h>
#include <kmsql/sql/grammar/statements.h>
#include <kmsql/sql/parser/parser_typedef.h>

// Auto update column and line number
#define YY_USER_ACTION                        \
  yylloc->first_line = yylloc->last_line;     \
  yylloc->first_column = yylloc->last_column; \
  for (int i = 0; yytext[i] != '\0'; i++) {   \
    yylloc->total_column++;                   \
    yylloc->string_length++;                  \
    if (yytext[i] == '\n') {                  \
      yylloc->last_line++;                    \
      yylloc->last_column = 0;                \
    } else {                                  \
      yylloc->last_column++;                  \
    }                                         \
  }

#line 182 "bison_parser.cc"

/* Token type.  */
#ifndef HSQL_TOKENTYPE
# define HSQL_TOKENTYPE
  enum hsql_tokentype
  {
    SQL_IDENTIFIER = 258,
    SQL_STRING = 259,
    SQL_FLOATVAL = 260,
    SQL_INTVAL = 261,
    SQL_DEALLOCATE = 262,
    SQL_PARAMETERS = 263,
    SQL_INTERSECT = 264,
    SQL_TEMPORARY = 265,
    SQL_TIMESTAMP = 266,
    SQL_DISTINCT = 267,
    SQL_NVARCHAR = 268,
    SQL_RESTRICT = 269,
    SQL_TRUNCATE = 270,
    SQL_ANALYZE = 271,
    SQL_BETWEEN = 272,
    SQL_CASCADE = 273,
    SQL_COLUMNS = 274,
    SQL_CONTROL = 275,
    SQL_DEFAULT = 276,
    SQL_EXECUTE = 277,
    SQL_EXPLAIN = 278,
    SQL_ENCODING = 279,
    SQL_INTEGER = 280,
    SQL_NATURAL = 281,
    SQL_PREPARE = 282,
    SQL_SCHEMAS = 283,
    SQL_CHARACTER_VARYING = 284,
    SQL_REAL = 285,
    SQL_DECIMAL = 286,
    SQL_SMALLINT = 287,
    SQL_BIGINT = 288,
    SQL_SPATIAL = 289,
    SQL_VARCHAR = 290,
    SQL_VIRTUAL = 291,
    SQL_DESCRIBE = 292,
    SQL_BEFORE = 293,
    SQL_COLUMN = 294,
    SQL_CREATE = 295,
    SQL_DELETE = 296,
    SQL_DIRECT = 297,
    SQL_DOUBLE = 298,
    SQL_ESCAPE = 299,
    SQL_EXCEPT = 300,
    SQL_EXISTS = 301,
    SQL_EXTRACT = 302,
    SQL_CAST = 303,
    SQL_FORMAT = 304,
    SQL_GLOBAL = 305,
    SQL_HAVING = 306,
    SQL_IMPORT = 307,
    SQL_INSERT = 308,
    SQL_ISNULL = 309,
    SQL_OFFSET = 310,
    SQL_RENAME = 311,
    SQL_SCHEMA = 312,
    SQL_SELECT = 313,
    SQL_SORTED = 314,
    SQL_TABLES = 315,
    SQL_UNLOAD = 316,
    SQL_UPDATE = 317,
    SQL_VALUES = 318,
    SQL_AFTER = 319,
    SQL_ALTER = 320,
    SQL_CROSS = 321,
    SQL_DELTA = 322,
    SQL_FLOAT = 323,
    SQL_GROUP = 324,
    SQL_INDEX = 325,
    SQL_INNER = 326,
    SQL_LIMIT = 327,
    SQL_LOCAL = 328,
    SQL_MERGE = 329,
    SQL_MINUS = 330,
    SQL_ORDER = 331,
    SQL_OVER = 332,
    SQL_OUTER = 333,
    SQL_RIGHT = 334,
    SQL_TABLE = 335,
    SQL_UNION = 336,
    SQL_USING = 337,
    SQL_WHERE = 338,
    SQL_CALL = 339,
    SQL_CASE = 340,
    SQL_CHAR = 341,
    SQL_COPY = 342,
    SQL_DATE = 343,
    SQL_DATETIME = 344,
    SQL_DESC = 345,
    SQL_DROP = 346,
    SQL_ELSE = 347,
    SQL_FILE = 348,
    SQL_FROM = 349,
    SQL_FULL = 350,
    SQL_HASH = 351,
    SQL_HINT = 352,
    SQL_INTO = 353,
    SQL_JOIN = 354,
    SQL_LEFT = 355,
    SQL_LIKE = 356,
    SQL_LOAD = 357,
    SQL_LONG = 358,
    SQL_NULL = 359,
    SQL_PARTITION = 360,
    SQL_PLAN = 361,
    SQL_SHOW = 362,
    SQL_TEXT = 363,
    SQL_THEN = 364,
    SQL_TIME = 365,
    SQL_VIEW = 366,
    SQL_WHEN = 367,
    SQL_WITH = 368,
    SQL_ADD = 369,
    SQL_ALL = 370,
    SQL_AND = 371,
    SQL_ASC = 372,
    SQL_END = 373,
    SQL_FOR = 374,
    SQL_INT = 375,
    SQL_NOT = 376,
    SQL_OFF = 377,
    SQL_SET = 378,
    SQL_TOP = 379,
    SQL_AS = 380,
    SQL_BY = 381,
    SQL_IF = 382,
    SQL_IN = 383,
    SQL_IS = 384,
    SQL_OF = 385,
    SQL_ON = 386,
    SQL_OR = 387,
    SQL_TO = 388,
    SQL_NO = 389,
    SQL_ARRAY = 390,
    SQL_CONCAT = 391,
    SQL_ILIKE = 392,
    SQL_SECOND = 393,
    SQL_MINUTE = 394,
    SQL_HOUR = 395,
    SQL_DAY = 396,
    SQL_MONTH = 397,
    SQL_YEAR = 398,
    SQL_SECONDS = 399,
    SQL_MINUTES = 400,
    SQL_HOURS = 401,
    SQL_DAYS = 402,
    SQL_MONTHS = 403,
    SQL_YEARS = 404,
    SQL_INTERVAL = 405,
    SQL_TRUE = 406,
    SQL_FALSE = 407,
    SQL_BOOLEAN = 408,
    SQL_TRANSACTION = 409,
    SQL_BEGIN = 410,
    SQL_COMMIT = 411,
    SQL_ROLLBACK = 412,
    SQL_NOWAIT = 413,
    SQL_SKIP = 414,
    SQL_LOCKED = 415,
    SQL_SHARE = 416,
    SQL_RANGE = 417,
    SQL_ROWS = 418,
    SQL_GROUPS = 419,
    SQL_UNBOUNDED = 420,
    SQL_FOLLOWING = 421,
    SQL_PRECEDING = 422,
    SQL_CURRENT_ROW = 423,
    SQL_UNIQUE = 424,
    SQL_PRIMARY = 425,
    SQL_FOREIGN = 426,
    SQL_KEY = 427,
    SQL_REFERENCES = 428,
    SQL_EQUALS = 429,
    SQL_NOTEQUALS = 430,
    SQL_LESS = 431,
    SQL_GREATER = 432,
    SQL_LESSEQ = 433,
    SQL_GREATEREQ = 434,
    SQL_NOTNULL = 435,
    SQL_UMINUS = 436
  };
#endif

/* Value type.  */
#if ! defined HSQL_STYPE && ! defined HSQL_STYPE_IS_DECLARED
union HSQL_STYPE
{
#line 102 "bison_parser.y"

  // clang-format on
  bool bval;
  char* sval;
  double fval;
  int64_t ival;
  uintmax_t uval;

  // statements
  kmsql::AlterStatement* alter_stmt;
  kmsql::CreateStatement* create_stmt;
  kmsql::DeleteStatement* delete_stmt;
  kmsql::DropStatement* drop_stmt;
  kmsql::ExecuteStatement* exec_stmt;
  kmsql::ExportStatement* export_stmt;
  kmsql::ImportStatement* import_stmt;
  kmsql::InsertStatement* insert_stmt;
  kmsql::PrepareStatement* prep_stmt;
  kmsql::SelectStatement* select_stmt;
  kmsql::ShowStatement* show_stmt;
  kmsql::SQLStatement* statement;
  kmsql::TransactionStatement* transaction_stmt;
  kmsql::UpdateStatement* update_stmt;

  kmsql::Alias* alias_t;
  kmsql::AlterAction* alter_action_t;
  kmsql::ColumnConstraints* column_constraints_t;
  kmsql::ColumnDefinition* column_t;
  kmsql::ColumnType column_type_t;
  kmsql::ConstraintType column_constraint_t;
  kmsql::DatetimeField datetime_field;
  kmsql::DropColumnAction* drop_action_t;
  kmsql::Expr* expr;
  kmsql::FrameBound* frame_bound;
  kmsql::FrameDescription* frame_description;
  kmsql::FrameType frame_type;
  kmsql::GroupByDescription* group_t;
  kmsql::ImportType import_type_t;
  kmsql::JoinType join_type;
  kmsql::LimitDescription* limit;
  kmsql::LockingClause* locking_t;
  kmsql::OrderDescription* order;
  kmsql::OrderType order_type;
  kmsql::ReferencesSpecification* references_spec_t;
  kmsql::SetOperation* set_operator_t;
  kmsql::TableConstraint* table_constraint_t;
  kmsql::TableElement* table_element_t;
  kmsql::TableName table_name;
  kmsql::TableRef* table;
  kmsql::UpdateClause* update_t;
  kmsql::WindowDescription* window_description;
  kmsql::WithDescription* with_description_t;

  std::vector<char*>* str_vec;
  std::vector<kmsql::Expr*>* expr_vec;
  std::vector<kmsql::OrderDescription*>* order_vec;
  std::vector<kmsql::SQLStatement*>* stmt_vec;
  std::vector<kmsql::TableElement*>* table_element_vec;
  std::vector<kmsql::TableRef*>* table_vec;
  std::vector<kmsql::UpdateClause*>* update_vec;
  std::vector<kmsql::WithDescription*>* with_description_vec;
  std::vector<kmsql::LockingClause*>* locking_clause_vec;

  std::pair<int64_t, int64_t>* ival_pair;

  kmsql::RowLockMode lock_mode_t;
  kmsql::RowLockWaitPolicy lock_wait_policy_t;

  kmsql::ImportExportOptions* import_export_option_t;

  // clang-format off

#line 448 "bison_parser.cc"

};
typedef union HSQL_STYPE HSQL_STYPE;
# define HSQL_STYPE_IS_TRIVIAL 1
# define HSQL_STYPE_IS_DECLARED 1
#endif

/* Location type.  */
#if ! defined HSQL_LTYPE && ! defined HSQL_LTYPE_IS_DECLARED
typedef struct HSQL_LTYPE HSQL_LTYPE;
struct HSQL_LTYPE
{
  int first_line;
  int first_column;
  int last_line;
  int last_column;
};
# define HSQL_LTYPE_IS_DECLARED 1
# define HSQL_LTYPE_IS_TRIVIAL 1
#endif



int hsql_parse (kmsql::SQLParserResult* result, yyscan_t scanner);

#endif /* !YY_HSQL_BISON_PARSER_H_INCLUDED  */



#ifdef short
# undef short
#endif

/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
   <limits.h> and (if available) <stdint.h> are included
   so that the code can choose integer types of a good width.  */

#ifndef __PTRDIFF_MAX__
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
#  define YY_STDINT_H
# endif
#endif

/* Narrow types that promote to a signed type and that can represent a
   signed or unsigned integer of at least N bits.  In tables they can
   save space and decrease cache pressure.  Promoting to a signed type
   helps avoid bugs in integer arithmetic.  */

#ifdef __INT_LEAST8_MAX__
typedef __INT_LEAST8_TYPE__ yytype_int8;
#elif defined YY_STDINT_H
typedef int_least8_t yytype_int8;
#else
typedef signed char yytype_int8;
#endif

#ifdef __INT_LEAST16_MAX__
typedef __INT_LEAST16_TYPE__ yytype_int16;
#elif defined YY_STDINT_H
typedef int_least16_t yytype_int16;
#else
typedef short yytype_int16;
#endif

#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
       && UINT_LEAST8_MAX <= INT_MAX)
typedef uint_least8_t yytype_uint8;
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
typedef unsigned char yytype_uint8;
#else
typedef short yytype_uint8;
#endif

#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
       && UINT_LEAST16_MAX <= INT_MAX)
typedef uint_least16_t yytype_uint16;
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
typedef unsigned short yytype_uint16;
#else
typedef int yytype_uint16;
#endif

#ifndef YYPTRDIFF_T
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
# elif defined PTRDIFF_MAX
#  ifndef ptrdiff_t
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  endif
#  define YYPTRDIFF_T ptrdiff_t
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
# else
#  define YYPTRDIFF_T long
#  define YYPTRDIFF_MAXIMUM LONG_MAX
# endif
#endif

#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
#  define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
#  define YYSIZE_T size_t
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# else
#  define YYSIZE_T unsigned
# endif
#endif

#define YYSIZE_MAXIMUM                                  \
  YY_CAST (YYPTRDIFF_T,                                 \
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
            ? YYPTRDIFF_MAXIMUM                         \
            : YY_CAST (YYSIZE_T, -1)))

#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))

/* Stored state numbers (used for stacks). */
typedef yytype_int16 yy_state_t;

/* State numbers in computations.  */
typedef int yy_state_fast_t;

#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(Msgid) Msgid
# endif
#endif

#ifndef YY_ATTRIBUTE_PURE
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
#  define YY_ATTRIBUTE_PURE
# endif
#endif

#ifndef YY_ATTRIBUTE_UNUSED
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
#  define YY_ATTRIBUTE_UNUSED
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif

#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
    _Pragma ("GCC diagnostic push")                                     \
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
    _Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif

#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
    _Pragma ("GCC diagnostic push")                            \
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
# define YY_IGNORE_USELESS_CAST_END            \
    _Pragma ("GCC diagnostic pop")
#endif
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_END
#endif


#define YY_ASSERT(E) ((void) (0 && (E)))

#if ! defined yyoverflow || YYERROR_VERBOSE

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   elif defined __BUILTIN_VA_ARG_INCR
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
#   elif defined _AIX
#    define YYSTACK_ALLOC __alloca
#   elif defined _MSC_VER
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
#    define alloca _alloca
#   else
#    define YYSTACK_ALLOC alloca
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
#     ifndef EXIT_SUCCESS
#      define EXIT_SUCCESS 0
#     endif
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's 'empty if-body' warning.  */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
#  ifndef YYSTACK_ALLOC_MAXIMUM
    /* The OS might guarantee only one guard page at the bottom of the stack,
       and a page size can be as small as 4096 bytes.  So we cannot safely
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
       to allow for a few compiler-allocated temporary stack slots.  */
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
#  endif
# else
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
#  ifndef YYSTACK_ALLOC_MAXIMUM
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
#  endif
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
       && ! ((defined YYMALLOC || defined malloc) \
             && (defined YYFREE || defined free)))
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   ifndef EXIT_SUCCESS
#    define EXIT_SUCCESS 0
#   endif
#  endif
#  ifndef YYMALLOC
#   define YYMALLOC malloc
#   if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
#  ifndef YYFREE
#   define YYFREE free
#   if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */


#if (! defined yyoverflow \
     && (! defined __cplusplus \
         || (defined HSQL_LTYPE_IS_TRIVIAL && HSQL_LTYPE_IS_TRIVIAL \
             && defined HSQL_STYPE_IS_TRIVIAL && HSQL_STYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  yy_state_t yyss_alloc;
  YYSTYPE yyvs_alloc;
  YYLTYPE yyls_alloc;
};

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
             + YYSIZEOF (YYLTYPE)) \
      + 2 * YYSTACK_GAP_MAXIMUM)

# define YYCOPY_NEEDED 1

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
    do                                                                  \
      {                                                                 \
        YYPTRDIFF_T yynewbytes;                                         \
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
        Stack = &yyptr->Stack_alloc;                                    \
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
      }                                                                 \
    while (0)

#endif

#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined __GNUC__ && 1 < __GNUC__
#   define YYCOPY(Dst, Src, Count) \
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
#  else
#   define YYCOPY(Dst, Src, Count)              \
      do                                        \
        {                                       \
          YYPTRDIFF_T yyi;                      \
          for (yyi = 0; yyi < (Count); yyi++)   \
            (Dst)[yyi] = (Src)[yyi];            \
        }                                       \
      while (0)
#  endif
# endif
#endif /* !YYCOPY_NEEDED */

/* YYFINAL -- State number of the termination state.  */
#define YYFINAL  69
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   905

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  199
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  134
/* YYNRULES -- Number of rules.  */
#define YYNRULES  349
/* YYNSTATES -- Number of states.  */
#define YYNSTATES  640

#define YYUNDEFTOK  2
#define YYMAXUTOK   436


/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex, with out-of-bounds checking.  */
#define YYTRANSLATE(YYX)                                                \
  (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex.  */
static const yytype_uint8 yytranslate[] =
{
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,   188,     2,     2,
     193,   194,   186,   184,   197,   185,   195,   187,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,   196,
     177,   174,   178,   198,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,   191,     2,   192,   189,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
      95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
     105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
     115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
     125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
     135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
     145,   146,   147,   148,   149,   150,   151,   152,   153,   154,
     155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
     165,   166,   167,   168,   169,   170,   171,   172,   173,   175,
     176,   179,   180,   181,   182,   183,   190
};

#if HSQL_DEBUG
  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
static const yytype_int16 yyrline[] =
{
       0,   335,   335,   354,   360,   367,   371,   375,   376,   377,
     379,   380,   381,   382,   383,   384,   385,   386,   387,   388,
     394,   395,   397,   401,   406,   410,   420,   421,   422,   424,
     424,   430,   436,   438,   442,   454,   460,   473,   488,   490,
     491,   492,   494,   503,   507,   517,   527,   538,   554,   555,
     560,   571,   584,   596,   603,   610,   619,   620,   622,   626,
     631,   632,   634,   642,   643,   644,   645,   646,   647,   648,
     652,   653,   654,   655,   656,   657,   658,   659,   660,   661,
     662,   664,   665,   667,   668,   669,   671,   672,   674,   678,
     682,   687,   695,   696,   697,   698,   700,   701,   702,   704,
     712,   718,   724,   730,   736,   737,   744,   750,   752,   762,
     769,   780,   787,   795,   796,   803,   810,   814,   819,   829,
     833,   837,   849,   849,   851,   852,   861,   862,   864,   878,
     890,   895,   899,   903,   908,   909,   911,   921,   922,   924,
     926,   927,   929,   931,   932,   934,   939,   941,   942,   944,
     945,   947,   951,   956,   958,   959,   960,   964,   965,   967,
     968,   969,   970,   971,   972,   977,   981,   987,   988,   990,
     994,   999,   999,  1003,  1011,  1012,  1014,  1023,  1023,  1023,
    1023,  1023,  1025,  1026,  1026,  1026,  1026,  1026,  1026,  1026,
    1026,  1027,  1027,  1031,  1031,  1033,  1034,  1035,  1036,  1037,
    1039,  1039,  1040,  1041,  1042,  1043,  1044,  1045,  1046,  1047,
    1048,  1050,  1051,  1053,  1054,  1055,  1056,  1060,  1061,  1062,
    1063,  1065,  1066,  1068,  1069,  1071,  1072,  1073,  1074,  1075,
    1076,  1077,  1081,  1082,  1086,  1087,  1089,  1090,  1095,  1096,
    1097,  1101,  1102,  1103,  1105,  1106,  1107,  1108,  1109,  1111,
    1113,  1115,  1116,  1117,  1118,  1119,  1120,  1122,  1123,  1124,
    1125,  1126,  1127,  1129,  1129,  1131,  1133,  1135,  1137,  1138,
    1139,  1140,  1142,  1142,  1142,  1142,  1142,  1142,  1142,  1144,
    1146,  1147,  1149,  1150,  1152,  1154,  1156,  1167,  1168,  1179,
    1211,  1220,  1220,  1227,  1227,  1229,  1229,  1236,  1240,  1245,
    1253,  1259,  1263,  1268,  1269,  1271,  1271,  1273,  1273,  1275,
    1276,  1278,  1278,  1284,  1285,  1287,  1291,  1296,  1302,  1309,
    1310,  1311,  1312,  1314,  1315,  1316,  1322,  1322,  1324,  1326,
    1330,  1335,  1345,  1352,  1360,  1369,  1370,  1371,  1372,  1373,
    1374,  1375,  1376,  1377,  1378,  1380,  1386,  1386,  1389,  1393
};
#endif

#if HSQL_DEBUG || YYERROR_VERBOSE || 1
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "IDENTIFIER", "STRING", "FLOATVAL",
  "INTVAL", "DEALLOCATE", "PARAMETERS", "INTERSECT", "TEMPORARY",
  "TIMESTAMP", "DISTINCT", "NVARCHAR", "RESTRICT", "TRUNCATE", "ANALYZE",
  "BETWEEN", "CASCADE", "COLUMNS", "CONTROL", "DEFAULT", "EXECUTE",
  "EXPLAIN", "ENCODING", "INTEGER", "NATURAL", "PREPARE", "SCHEMAS",
  "CHARACTER_VARYING", "REAL", "DECIMAL", "SMALLINT", "BIGINT", "SPATIAL",
  "VARCHAR", "VIRTUAL", "DESCRIBE", "BEFORE", "COLUMN", "CREATE", "DELETE",
  "DIRECT", "DOUBLE", "ESCAPE", "EXCEPT", "EXISTS", "EXTRACT", "CAST",
  "FORMAT", "GLOBAL", "HAVING", "IMPORT", "INSERT", "ISNULL", "OFFSET",
  "RENAME", "SCHEMA", "SELECT", "SORTED", "TABLES", "UNLOAD", "UPDATE",
  "VALUES", "AFTER", "ALTER", "CROSS", "DELTA", "FLOAT", "GROUP", "INDEX",
  "INNER", "LIMIT", "LOCAL", "MERGE", "MINUS", "ORDER", "OVER", "OUTER",
  "RIGHT", "TABLE", "UNION", "USING", "WHERE", "CALL", "CASE", "CHAR",
  "COPY", "DATE", "DATETIME", "DESC", "DROP", "ELSE", "FILE", "FROM",
  "FULL", "HASH", "HINT", "INTO", "JOIN", "LEFT", "LIKE", "LOAD", "LONG",
  "NULL", "PARTITION", "PLAN", "SHOW", "TEXT", "THEN", "TIME", "VIEW",
  "WHEN", "WITH", "ADD", "ALL", "AND", "ASC", "END", "FOR", "INT", "NOT",
  "OFF", "SET", "TOP", "AS", "BY", "IF", "IN", "IS", "OF", "ON", "OR",
  "TO", "NO", "ARRAY", "CONCAT", "ILIKE", "SECOND", "MINUTE", "HOUR",
  "DAY", "MONTH", "YEAR", "SECONDS", "MINUTES", "HOURS", "DAYS", "MONTHS",
  "YEARS", "INTERVAL", "TRUE", "FALSE", "BOOLEAN", "TRANSACTION", "BEGIN",
  "COMMIT", "ROLLBACK", "NOWAIT", "SKIP", "LOCKED", "SHARE", "RANGE",
  "ROWS", "GROUPS", "UNBOUNDED", "FOLLOWING", "PRECEDING", "CURRENT_ROW",
  "UNIQUE", "PRIMARY", "FOREIGN", "KEY", "REFERENCES", "'='", "EQUALS",
  "NOTEQUALS", "'<'", "'>'", "LESS", "GREATER", "LESSEQ", "GREATEREQ",
  "NOTNULL", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "UMINUS", "'['",
  "']'", "'('", "')'", "'.'", "';'", "','", "'?'", "$accept", "input",
  "statement_list", "statement", "preparable_statement", "opt_hints",
  "hint_list", "hint", "transaction_statement", "opt_transaction_keyword",
  "prepare_statement", "prepare_target_query", "execute_statement",
  "import_statement", "file_type", "file_path",
  "opt_import_export_options", "import_export_options", "export_statement",
  "show_statement", "create_statement", "opt_not_exists",
  "table_elem_commalist", "table_elem", "column_def", "column_type",
  "opt_time_precision", "opt_decimal_specification",
  "opt_column_constraints", "column_constraints", "column_constraint",
  "table_constraint", "references_spec", "drop_statement", "opt_exists",
  "alter_statement", "alter_action", "drop_action", "delete_statement",
  "truncate_statement", "insert_statement", "opt_column_list",
  "update_statement", "update_clause_commalist", "update_clause",
  "select_statement", "select_within_set_operation",
  "select_within_set_operation_no_parentheses", "select_with_paren",
  "select_no_paren", "set_operator", "set_type", "opt_all",
  "select_clause", "opt_distinct", "select_list", "opt_from_clause",
  "from_clause", "opt_where", "opt_group", "opt_having", "opt_order",
  "order_list", "order_desc", "opt_order_type", "opt_top", "opt_limit",
  "expr_list", "opt_extended_literal_list", "extended_literal_list",
  "casted_extended_literal", "extended_literal", "expr_alias", "expr",
  "operand", "scalar_expr", "unary_expr", "binary_expr", "logic_expr",
  "in_expr", "case_expr", "case_list", "exists_expr", "comp_expr",
  "function_expr", "opt_window", "opt_partition", "opt_frame_clause",
  "frame_type", "frame_bound", "extract_expr", "cast_expr",
  "datetime_field", "datetime_field_plural", "duration_field",
  "array_expr", "array_index", "between_expr", "column_name", "literal",
  "string_literal", "bool_literal", "num_literal", "int_literal",
  "null_literal", "date_literal", "interval_literal", "param_expr",
  "table_ref", "table_ref_atomic", "nonjoin_table_ref_atomic",
  "table_ref_commalist", "table_ref_name", "table_ref_name_no_alias",
  "table_name", "opt_index_name", "table_alias", "opt_table_alias",
  "alias", "opt_alias", "opt_locking_clause", "opt_locking_clause_list",
  "locking_clause", "row_lock_mode", "opt_row_lock_policy",
  "opt_with_clause", "with_clause", "with_description_list",
  "with_description", "join_clause", "opt_join_type", "join_condition",
  "opt_semicolon", "ident_commalist", YY_NULLPTR
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
   (internal) symbol number NUM (which must be that of a token).  */
static const yytype_int16 yytoknum[] =
{
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
     355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
     365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
     375,   376,   377,   378,   379,   380,   381,   382,   383,   384,
     385,   386,   387,   388,   389,   390,   391,   392,   393,   394,
     395,   396,   397,   398,   399,   400,   401,   402,   403,   404,
     405,   406,   407,   408,   409,   410,   411,   412,   413,   414,
     415,   416,   417,   418,   419,   420,   421,   422,   423,   424,
     425,   426,   427,   428,    61,   429,   430,    60,    62,   431,
     432,   433,   434,   435,    43,    45,    42,    47,    37,    94,
     436,    91,    93,    40,    41,    46,    59,    44,    63
};
# endif

#define YYPACT_NINF (-463)

#define yypact_value_is_default(Yyn) \
  ((Yyn) == YYPACT_NINF)

#define YYTABLE_NINF (-347)

#define yytable_value_is_error(Yyn) \
  ((Yyn) == YYTABLE_NINF)

  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     STATE-NUM.  */
static const yytype_int16 yypact[] =
{
     659,    58,    86,   102,   234,    86,   -14,    95,   181,   146,
      86,   227,     8,    36,   145,   277,   141,   141,   141,   323,
     161,  -463,   224,  -463,   224,  -463,  -463,  -463,  -463,  -463,
    -463,  -463,  -463,  -463,  -463,  -463,  -463,   -25,  -463,   361,
     189,  -463,   193,   280,  -463,   264,   264,   264,    86,   403,
      86,   286,  -463,   295,   -25,   294,   -32,   295,   295,   295,
      86,  -463,   288,   229,  -463,  -463,  -463,  -463,  -463,  -463,
     642,  -463,   332,  -463,  -463,   309,    77,  -463,   158,  -463,
     431,    19,   436,   314,   439,    86,    86,   365,  -463,   357,
     258,   444,   409,    86,   262,   267,   461,   461,   461,   460,
      86,    86,  -463,   274,   277,  -463,   281,   467,   471,  -463,
    -463,  -463,   -25,   372,   363,   -25,   191,  -463,  -463,  -463,
     756,   297,   496,  -463,   497,  -463,  -463,    38,  -463,   308,
     306,  -463,  -463,  -463,  -463,  -463,  -463,  -463,  -463,  -463,
    -463,  -463,  -463,  -463,   458,  -463,   376,   -33,   258,   364,
    -463,   461,   505,   123,   335,   -31,  -463,  -463,   419,  -463,
    -463,  -463,   -48,   -48,   -48,  -463,  -463,  -463,  -463,  -463,
     508,  -463,  -463,  -463,   364,   441,  -463,  -463,    77,  -463,
    -463,   364,   441,   364,   150,   393,  -463,  -463,  -463,  -463,
    -463,  -463,  -463,  -463,  -463,  -463,  -463,  -463,  -463,  -463,
    -463,   394,  -463,   354,  -463,  -463,  -463,    19,  -463,    86,
     517,   410,    24,   397,   149,   331,   333,   334,   273,   384,
     337,   433,  -463,   293,   -42,   459,  -463,  -463,  -463,  -463,
    -463,  -463,  -463,  -463,  -463,  -463,  -463,  -463,  -463,  -463,
    -463,  -463,   427,  -463,   -17,   336,  -463,   364,   444,  -463,
     491,  -463,  -463,   338,    45,  -463,   365,  -463,   339,    -7,
    -463,   445,   341,  -463,    47,   191,   -25,   343,  -463,   140,
     191,   -42,   478,   104,    90,  -463,   393,  -463,   416,  -463,
    -463,   349,   450,  -463,   732,   355,   379,   381,    87,  -463,
    -463,  -463,   410,    17,    23,   489,   354,   364,   364,   -39,
      73,   362,   433,   673,   364,   117,   367,   -77,   364,   364,
     433,  -463,   433,   131,   370,    -8,   433,   433,   433,   433,
     433,   433,   433,   433,   433,   433,   433,   433,   433,   433,
     433,   467,    86,  -463,   553,    19,   -42,  -463,   295,    45,
     554,   403,    96,  -463,    19,  -463,   508,    15,   365,  -463,
     364,  -463,   561,  -463,  -463,  -463,  -463,   364,  -463,  -463,
    -463,   393,   364,   364,  -463,   395,  -463,   404,   128,  -463,
     732,   505,   461,  -463,  -463,   378,  -463,   380,  -463,  -463,
     382,  -463,  -463,   383,  -463,  -463,  -463,  -463,   385,  -463,
    -463,   119,   505,   388,   396,  -463,    24,  -463,   495,   364,
    -463,  -463,   392,   472,   200,   202,   137,   364,   364,  -463,
     489,   473,    72,  -463,  -463,  -463,   474,   602,   702,   433,
     398,   293,  -463,   490,   402,   702,   702,   702,   702,   423,
     423,   423,   423,   117,   117,   -79,   -79,   -79,   -76,   405,
    -463,  -463,   130,   595,   152,  -463,  -463,  -463,   201,   156,
    -463,   410,  -463,     9,  -463,   406,  -463,    51,  -463,   530,
    -463,  -463,  -463,  -463,   -42,   -42,   540,  -463,   505,  -463,
     446,  -463,   421,   162,  -463,   607,   610,  -463,   611,   614,
     615,  -463,  -463,   518,  -463,   451,    86,  -463,   119,  -463,
    -463,   168,   505,   505,  -463,   432,  -463,   169,  -463,   364,
     732,   364,   364,  -463,   194,   206,   430,  -463,   433,   702,
     293,   434,   178,  -463,  -463,  -463,  -463,  -463,   623,   403,
    -463,   435,   531,  -463,  -463,  -463,   560,   573,   574,   533,
      15,   636,  -463,  -463,  -463,   527,  -463,  -463,    25,  -463,
    -463,  -463,   464,   179,   465,   466,   468,  -463,  -463,   258,
    -463,  -463,  -463,   185,   186,   549,   495,   -53,   469,   -42,
     215,  -463,   364,  -463,   673,   476,   198,  -463,  -463,  -463,
    -463,    51,    15,  -463,  -463,  -463,    15,   148,   462,   364,
    -463,  -463,  -463,   655,  -463,  -463,  -463,  -463,  -463,   492,
     541,   441,  -463,  -463,  -463,  -463,   -42,  -463,  -463,  -463,
    -463,   375,   505,   -19,   477,  -463,   364,   254,   475,   364,
     199,   364,  -463,  -463,   341,  -463,  -463,  -463,   479,    34,
     505,   -42,  -463,  -463,   -42,  -463,   100,    53,   147,  -463,
    -463,   208,  -463,  -463,   556,  -463,  -463,  -463,    53,  -463
};

  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
     Performed when YYTABLE does not specify something else to do.  Zero
     means the default is an error.  */
static const yytype_int16 yydefact[] =
{
     327,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,    30,    30,    30,     0,
     347,     3,    21,    19,    21,    18,     8,     9,     7,    11,
      16,    17,    13,    14,    12,    15,    10,     0,   326,     0,
     301,   110,    33,     0,    50,    57,    57,    57,     0,     0,
       0,     0,   300,   105,     0,     0,     0,   105,   105,   105,
       0,    48,     0,   328,   329,    29,    26,    28,    27,     1,
     327,     2,     0,     6,     5,   158,   119,   120,   150,   102,
       0,   168,     0,     0,   304,     0,     0,   144,    37,     0,
     114,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    49,     0,     0,     4,     0,     0,   138,   132,
     133,   131,     0,   135,     0,     0,   164,   302,   279,   282,
     284,     0,     0,   285,     0,   280,   281,     0,   290,     0,
     167,   169,   171,   173,   272,   273,   274,   283,   275,   276,
     277,   278,    32,    31,     0,   303,     0,     0,   114,     0,
     109,     0,     0,     0,     0,   144,   116,   104,     0,   127,
     126,    38,    41,    41,    41,   103,   100,   101,   331,   330,
       0,   284,   157,   137,     0,   150,   123,   122,   124,   134,
     130,     0,   150,     0,     0,   314,   251,   252,   253,   254,
     255,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     287,     0,   286,   289,   174,   175,    34,     0,    56,     0,
       0,   327,     0,     0,   268,     0,     0,     0,     0,     0,
       0,     0,   270,     0,   143,   177,   184,   185,   186,   179,
     181,   187,   180,   200,   188,   189,   190,   191,   183,   178,
     193,   194,     0,   348,     0,     0,   112,     0,     0,   115,
       0,   106,   107,     0,     0,    47,   144,    46,    24,     0,
      22,   141,   139,   165,   312,   164,     0,   149,   151,   156,
     164,   160,   162,   159,     0,   128,   313,   315,     0,   288,
     170,     0,     0,    53,     0,     0,     0,     0,     0,    58,
      60,    61,   327,   138,     0,     0,     0,     0,     0,     0,
       0,     0,     0,   196,     0,   195,     0,     0,     0,     0,
       0,   197,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,   113,     0,     0,   118,   117,   105,     0,
       0,     0,     0,    36,     0,    20,     0,     0,   144,   140,
       0,   310,     0,   311,   176,   121,   125,     0,   155,   154,
     153,   314,     0,     0,   319,     0,   321,     0,   325,   316,
       0,     0,     0,    79,    73,     0,    75,    85,    76,    63,
       0,    70,    71,     0,    67,    68,    74,    77,    82,    72,
      64,    87,     0,     0,     0,    52,     0,    55,   235,     0,
     269,   271,     0,     0,     0,     0,     0,     0,     0,   219,
       0,     0,     0,   192,   182,   211,   212,     0,   207,     0,
       0,     0,   198,     0,   210,   209,   225,   226,   227,   228,
     229,   230,   231,   202,   201,   204,   203,   205,   206,     0,
      35,   349,     0,     0,     0,    45,    43,    40,     0,     0,
      23,   327,   142,   291,   293,     0,   295,   308,   294,   146,
     166,   309,   152,   129,   163,   161,     0,   322,     0,   324,
       0,   317,     0,     0,    51,     0,     0,    69,     0,     0,
       0,    78,    94,     0,    93,     0,     0,    62,    86,    88,
      90,     0,     0,     0,    59,     0,   232,     0,   223,     0,
       0,     0,     0,   217,     0,     0,     0,   265,     0,   208,
       0,     0,     0,   199,   266,   111,   108,    39,     0,     0,
      25,     0,     0,   343,   335,   341,   339,   342,   337,     0,
       0,     0,   307,   299,   305,     0,   136,   320,   325,   323,
     172,    54,     0,     0,     0,     0,     0,    95,    92,   114,
      89,    91,    97,     0,     0,   237,   235,     0,     0,   221,
       0,   220,     0,   224,   267,     0,     0,   215,   213,    44,
      42,   308,     0,   338,   340,   336,     0,   292,   309,     0,
     318,    66,    84,     0,    80,    65,    81,    99,    96,     0,
       0,   150,   233,   249,   250,   218,   222,   216,   214,   296,
     332,   344,     0,   148,     0,    98,     0,   240,     0,     0,
       0,     0,   145,    83,   236,   241,   242,   243,     0,     0,
       0,   345,   333,   306,   147,   234,     0,     0,     0,   248,
     238,     0,   247,   245,     0,   246,   244,   334,     0,   239
};

  /* YYPGOTO[NTERM-NUM].  */
static const yytype_int16 yypgoto[] =
{
    -463,  -463,  -463,   605,  -463,   652,  -463,   342,  -463,   311,
    -463,  -463,  -463,  -463,  -319,   -81,   240,   345,  -463,  -463,
    -463,   373,  -463,   282,  -463,  -325,  -463,  -463,  -463,  -463,
     192,  -463,  -441,  -463,   -44,  -463,  -463,  -463,  -463,  -463,
    -463,  -142,  -463,  -463,   429,  -210,   -84,  -463,    41,   -50,
     -29,  -463,  -463,   -74,   399,  -463,  -463,  -463,  -136,  -463,
    -463,  -170,  -463,   328,  -463,  -463,     3,  -297,  -463,  -263,
     480,   488,   340,  -147,  -191,  -463,  -463,  -463,  -463,  -463,
    -463,   407,  -463,  -463,  -463,   135,  -463,  -463,  -463,  -396,
    -463,  -463,  -139,  -463,  -463,  -463,  -463,  -463,  -463,   -61,
    -463,  -463,   566,   -98,  -463,  -463,   570,  -463,  -463,  -462,
     126,  -463,  -463,  -463,    -2,  -463,  -463,   134,   437,  -463,
     347,  -463,   426,  -463,   171,  -463,  -463,  -463,   606,  -463,
    -463,  -463,  -463,  -350
};

  /* YYDEFGOTO[NTERM-NUM].  */
static const yytype_int16 yydefgoto[] =
{
      -1,    19,    20,    21,    22,    73,   259,   260,    23,    66,
      24,   143,    25,    26,    89,   162,   255,   342,    27,    28,
      29,    84,   288,   289,   290,   391,   481,   477,   487,   488,
     489,   291,   490,    30,    93,    31,   251,   252,    32,    33,
      34,   153,    35,   155,   156,    36,   175,   176,   177,    77,
     112,   113,   180,    78,   174,   261,   348,   349,   150,   536,
     612,   116,   267,   268,   360,   108,   185,   262,   129,   130,
     131,   132,   263,   264,   225,   226,   227,   228,   229,   230,
     231,   300,   232,   233,   234,   496,   591,   618,   619,   630,
     235,   236,   198,   199,   200,   237,   238,   239,   240,   241,
     134,   135,   136,   137,   138,   139,   140,   141,   452,   453,
     454,   455,   456,    51,   457,   146,   532,   533,   534,   354,
     275,   276,   277,   368,   471,    37,    38,    63,    64,   458,
     529,   622,    71,   244
};

  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
     positive, shift that token.  If negative, reduce the rule whose
     number is the opposite.  If YYTABLE_NINF, syntax error.  */
static const yytype_int16 yytable[] =
{
      41,   283,   224,    44,    95,   265,   213,   412,    52,   172,
      56,    40,   270,    99,   100,   101,   163,   164,    40,   249,
     133,   473,   446,   118,   119,   120,   400,   284,   303,   173,
     305,   182,   611,    75,   269,   522,   271,   273,   178,   308,
     626,   178,   491,   119,   120,   472,    87,   551,    90,   115,
     351,   627,   149,    55,   351,   309,    45,   316,   102,   626,
     316,   210,    97,   308,   279,   253,    46,   121,   577,   340,
     242,   299,   442,   298,   308,   523,   307,   308,    76,   309,
     524,   449,   397,   147,   148,    39,   109,   525,   526,    40,
     309,   158,   211,   309,   341,    94,   422,    47,   166,   167,
     336,    98,   497,   246,   527,    42,    57,   122,  -344,   528,
     330,   303,   331,   423,   601,   331,    58,   414,   538,   417,
     343,   418,   110,   123,   512,   424,   425,   426,   427,   428,
     429,   430,   431,   432,   433,   434,   435,   436,   437,   438,
     133,   593,   553,   554,   168,   254,   133,    59,   605,   266,
     404,   405,   364,   214,   118,   119,   120,   403,   111,   363,
     212,   415,   416,   308,    60,   407,   248,   109,    54,   124,
     125,   126,   352,   306,   522,   558,   531,   333,   350,   309,
     334,    75,   356,   469,   470,   408,   245,   345,   124,    48,
     346,   409,   178,   285,   286,   287,   215,   216,   217,   628,
     570,    54,   629,   110,   127,    61,  -297,   281,   451,   401,
     269,   398,   459,   566,   523,   464,   465,   128,   628,   524,
     308,   629,   334,   482,   365,   518,   525,   526,   509,   502,
     358,   634,   419,   439,   114,   218,   309,    43,   122,   111,
     483,   521,   639,   527,    50,   402,   183,  -344,   528,   408,
     519,   366,   610,   316,   123,   503,   308,   359,   468,   420,
     504,   505,   367,   184,   507,   272,   632,   633,   355,   350,
     631,   219,   309,   361,   133,    49,   214,   118,   119,   120,
      62,   395,   603,   133,   396,   220,   469,   470,   484,   485,
     447,   474,   486,   448,   443,    65,   214,   118,   119,   120,
     124,   125,   126,   327,   328,   329,   330,    53,   331,   614,
     308,   501,   561,   635,   636,   562,   308,   564,   308,   215,
     216,   217,   308,    69,   515,   500,   309,   207,    67,    68,
     440,   308,   309,   595,   309,   221,   222,    72,   309,   215,
     216,   217,   293,   223,   294,  -298,   517,   309,   128,   448,
     520,    75,   557,   207,   559,   560,   541,    70,   218,   334,
     506,   122,   552,   556,    79,   334,   350,   214,   118,   119,
     120,   511,   568,   582,    82,   350,   583,   123,   218,   588,
     589,   122,   334,   334,    80,   298,    81,   214,   118,   119,
     120,    83,   598,   623,   219,   350,   334,   123,   118,   119,
     120,   522,   637,   256,   257,   334,    88,   587,   220,    91,
     215,   216,   217,   103,   219,   596,   615,   616,   617,    85,
      86,   607,    92,   124,   125,   126,   104,    96,   220,   106,
     301,   216,   217,   107,   117,   144,   214,   118,   119,   120,
     142,   523,   145,   124,   125,   126,   524,   154,   149,   218,
     151,   152,   122,   525,   526,   157,   159,   608,   221,   222,
     565,   160,   621,   165,   624,   161,   223,    54,   123,   218,
     527,   128,   122,   171,   170,   528,   310,   311,   221,   222,
     216,   217,   122,   173,   549,   219,   223,   179,   123,   181,
     201,   128,   186,   187,   188,   189,   190,   191,   123,   220,
     202,   203,   206,   207,   208,   302,   609,   209,   243,   247,
     250,   258,   274,   311,   124,   125,   126,   114,   218,   220,
     282,   122,   292,    15,   295,   332,   296,   297,   304,   335,
     338,   339,   344,   362,   124,   125,   126,   123,   350,   347,
     357,   370,   371,   372,   124,   125,   126,    75,   392,   221,
     222,   393,   315,   394,   302,   410,   441,   223,   445,   316,
     312,   413,   128,   421,   461,   467,   499,   466,   220,   221,
     222,   475,   495,   476,   419,   478,   479,   223,   480,   127,
     313,   492,   128,   124,   125,   126,   498,   314,   315,   493,
     308,   510,   128,   331,   513,   316,   317,   514,   516,   535,
    -347,  -347,   537,   530,  -347,  -347,   539,   325,   326,   327,
     328,   329,   330,   542,   331,   540,   543,   544,   221,   222,
     545,   546,   547,   548,   563,   555,   223,   569,   567,   571,
     572,   128,   576,   318,   319,   320,   321,   322,   573,   578,
     323,   324,  -346,   325,   326,   327,   328,   329,   330,     1,
     331,   574,   575,   579,   590,   602,   311,     2,   581,   584,
     585,   604,   586,   594,     3,   486,     1,   606,   620,     4,
     597,   613,   638,   625,     2,   105,    74,   337,   494,     5,
     550,     3,     6,     7,   444,   462,     4,   280,   450,   278,
     460,   592,   399,   204,     8,     9,     5,   205,   600,     6,
       7,   353,   369,   312,    10,   599,   406,    11,   463,   580,
     169,     8,     9,     0,     0,     0,     0,     0,   508,     0,
       0,    10,     0,   411,    11,     0,     0,   311,     0,    12,
       0,   315,     0,    13,     0,     0,     0,     0,   316,   317,
       0,     0,     0,   373,     0,     0,    12,     0,     0,    14,
      13,     0,     0,     0,     0,    15,   311,   374,     0,     0,
       0,   375,   376,   377,   378,   379,    14,   380,     0,     0,
       0,     0,    15,     0,   312,   381,   318,   319,   320,   321,
     322,     0,     0,   323,   324,     0,   325,   326,   327,   328,
     329,   330,     0,   331,   411,     0,     0,    16,    17,    18,
     382,     0,   315,  -347,     0,     0,     0,     0,     0,   316,
     317,     0,     0,     0,    16,    17,    18,     0,   383,     0,
     384,   385,     0,     0,     0,     0,     0,     0,     0,     0,
       0,   315,     0,     0,     0,   386,     0,     0,   316,  -347,
     387,     0,   388,     0,     0,     0,     0,   318,   319,   320,
     321,   322,   389,     0,   323,   324,     0,   325,   326,   327,
     328,   329,   330,     0,   331,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,  -347,  -347,  -347,   321,
     322,     0,     0,   323,   324,   390,   325,   326,   327,   328,
     329,   330,     0,   331,   186,   187,   188,   189,   190,   191,
     192,   193,   194,   195,   196,   197
};

static const yytype_int16 yycheck[] =
{
       2,   211,   149,     5,    54,   175,   148,   304,    10,   107,
      12,     3,   182,    57,    58,    59,    97,    98,     3,   155,
      81,   371,   341,     4,     5,     6,     3,     3,   219,    12,
     221,   115,    51,    58,   181,    26,   183,   184,   112,   116,
       6,   115,   392,     5,     6,   370,    48,   488,    50,    78,
       3,    17,    83,    12,     3,   132,    70,   136,    60,     6,
     136,    94,    94,   116,   203,   113,    80,    48,   530,    24,
     151,   218,   335,   112,   116,    66,   223,   116,    37,   132,
      71,   344,   292,    85,    86,    27,     9,    78,    79,     3,
     132,    93,   125,   132,    49,    54,   104,   111,   100,   101,
     247,   133,   399,   153,    95,     3,    70,    88,    99,   100,
     189,   302,   191,   121,   576,   191,    80,   194,   468,   310,
     256,   312,    45,   104,   421,   316,   317,   318,   319,   320,
     321,   322,   323,   324,   325,   326,   327,   328,   329,   330,
     201,   194,   492,   493,   103,   193,   207,   111,   589,   178,
     297,   298,    62,     3,     4,     5,     6,   296,    81,    55,
     193,   308,   309,   116,    19,    92,   197,     9,   193,   150,
     151,   152,   125,   223,    26,   500,   125,   194,   197,   132,
     197,    58,   266,   158,   159,   112,    63,   194,   150,    94,
     197,   118,   266,   169,   170,   171,    46,    47,    48,   165,
     519,   193,   168,    45,   185,    60,   197,   209,   193,   186,
     357,   194,   348,   510,    66,   362,   363,   198,   165,    71,
     116,   168,   197,   104,   134,    24,    78,    79,   419,    92,
      90,   627,   101,   331,    76,    85,   132,     3,    88,    81,
     121,   451,   638,    95,    98,   295,    55,    99,   100,   112,
      49,   161,   602,   136,   104,   118,   116,   117,   130,   128,
     407,   408,   172,    72,   192,   115,   166,   167,   265,   197,
     620,   121,   132,   270,   335,    94,     3,     4,     5,     6,
       3,   194,   579,   344,   197,   135,   158,   159,   169,   170,
     194,   372,   173,   197,   338,   154,     3,     4,     5,     6,
     150,   151,   152,   186,   187,   188,   189,    80,   191,   606,
     116,   109,   118,   166,   167,   109,   116,   508,   116,    46,
      47,    48,   116,     0,   194,   125,   132,   197,    17,    18,
     332,   116,   132,   118,   132,   185,   186,   113,   132,    46,
      47,    48,   193,   193,   195,   197,   194,   132,   198,   197,
     194,    58,   499,   197,   501,   502,   194,   196,    85,   197,
     410,    88,   194,   194,     3,   197,   197,     3,     4,     5,
       6,   421,   194,   194,    94,   197,   197,   104,    85,   194,
     194,    88,   197,   197,   195,   112,   193,     3,     4,     5,
       6,   127,   194,   194,   121,   197,   197,   104,     4,     5,
       6,    26,   194,   163,   164,   197,     3,   549,   135,   123,
      46,    47,    48,   125,   121,   562,   162,   163,   164,    46,
      47,   591,   127,   150,   151,   152,   197,   133,   135,    97,
      46,    47,    48,   124,     3,   121,     3,     4,     5,     6,
       4,    66,     3,   150,   151,   152,    71,     3,    83,    85,
      93,   193,    88,    78,    79,    46,   194,    82,   185,   186,
     510,   194,   609,     3,   611,     4,   193,   193,   104,    85,
      95,   198,    88,     6,   193,   100,    17,    54,   185,   186,
      47,    48,    88,    12,   486,   121,   193,   115,   104,   126,
     193,   198,   138,   139,   140,   141,   142,   143,   104,   135,
       4,     4,   194,   197,    46,   121,   131,   131,     3,   174,
      91,     3,   119,    54,   150,   151,   152,    76,    85,   135,
       3,    88,   125,   113,   193,    98,   193,   193,   191,   193,
      39,   193,   193,    55,   150,   151,   152,   104,   197,    94,
     197,   125,   193,    93,   150,   151,   152,    58,   193,   185,
     186,   172,   129,   172,   121,   193,     3,   193,     4,   136,
     101,   194,   198,   193,     3,   161,    94,   172,   135,   185,
     186,   193,    77,   193,   101,   193,   193,   193,   193,   185,
     121,   193,   198,   150,   151,   152,   194,   128,   129,   193,
     116,   193,   198,   191,   104,   136,   137,   192,     3,    69,
     177,   178,    62,   197,   181,   182,   160,   184,   185,   186,
     187,   188,   189,     6,   191,   194,     6,     6,   185,   186,
       6,     6,   104,   172,   194,   193,   193,     4,   194,   194,
      99,   198,    99,   174,   175,   176,   177,   178,    78,     3,
     181,   182,     0,   184,   185,   186,   187,   188,   189,     7,
     191,    78,    78,   126,   105,   193,    54,    15,   194,   194,
     194,     6,   194,   194,    22,   173,     7,   126,   193,    27,
     194,   194,   116,   194,    15,    70,    24,   248,   396,    37,
     488,    22,    40,    41,   339,   357,    27,   207,   346,   201,
     350,   556,   293,   127,    52,    53,    37,   127,   572,    40,
      41,   264,   276,   101,    62,   571,   299,    65,   361,   538,
     104,    52,    53,    -1,    -1,    -1,    -1,    -1,   116,    -1,
      -1,    62,    -1,   121,    65,    -1,    -1,    54,    -1,    87,
      -1,   129,    -1,    91,    -1,    -1,    -1,    -1,   136,   137,
      -1,    -1,    -1,    11,    -1,    -1,    87,    -1,    -1,   107,
      91,    -1,    -1,    -1,    -1,   113,    54,    25,    -1,    -1,
      -1,    29,    30,    31,    32,    33,   107,    35,    -1,    -1,
      -1,    -1,   113,    -1,   101,    43,   174,   175,   176,   177,
     178,    -1,    -1,   181,   182,    -1,   184,   185,   186,   187,
     188,   189,    -1,   191,   121,    -1,    -1,   155,   156,   157,
      68,    -1,   129,   101,    -1,    -1,    -1,    -1,    -1,   136,
     137,    -1,    -1,    -1,   155,   156,   157,    -1,    86,    -1,
      88,    89,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,   129,    -1,    -1,    -1,   103,    -1,    -1,   136,   137,
     108,    -1,   110,    -1,    -1,    -1,    -1,   174,   175,   176,
     177,   178,   120,    -1,   181,   182,    -1,   184,   185,   186,
     187,   188,   189,    -1,   191,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,   174,   175,   176,   177,
     178,    -1,    -1,   181,   182,   153,   184,   185,   186,   187,
     188,   189,    -1,   191,   138,   139,   140,   141,   142,   143,
     144,   145,   146,   147,   148,   149
};

  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
     symbol of state STATE-NUM.  */
static const yytype_int16 yystos[] =
{
       0,     7,    15,    22,    27,    37,    40,    41,    52,    53,
      62,    65,    87,    91,   107,   113,   155,   156,   157,   200,
     201,   202,   203,   207,   209,   211,   212,   217,   218,   219,
     232,   234,   237,   238,   239,   241,   244,   324,   325,    27,
       3,   313,     3,     3,   313,    70,    80,   111,    94,    94,
      98,   312,   313,    80,   193,   247,   313,    70,    80,   111,
      19,    60,     3,   326,   327,   154,   208,   208,   208,     0,
     196,   331,   113,   204,   204,    58,   247,   248,   252,     3,
     195,   193,    94,   127,   220,   220,   220,   313,     3,   213,
     313,   123,   127,   233,   247,   248,   133,    94,   133,   233,
     233,   233,   313,   125,   197,   202,    97,   124,   264,     9,
      45,    81,   249,   250,    76,   249,   260,     3,     4,     5,
       6,    48,    88,   104,   150,   151,   152,   185,   198,   267,
     268,   269,   270,   298,   299,   300,   301,   302,   303,   304,
     305,   306,     4,   210,   121,     3,   314,   313,   313,    83,
     257,    93,   193,   240,     3,   242,   243,    46,   313,   194,
     194,     4,   214,   214,   214,     3,   313,   313,   247,   327,
     193,     6,   302,    12,   253,   245,   246,   247,   252,   115,
     251,   126,   245,    55,    72,   265,   138,   139,   140,   141,
     142,   143,   144,   145,   146,   147,   148,   149,   291,   292,
     293,   193,     4,     4,   301,   305,   194,   197,    46,   131,
      94,   125,   193,   240,     3,    46,    47,    48,    85,   121,
     135,   185,   186,   193,   272,   273,   274,   275,   276,   277,
     278,   279,   281,   282,   283,   289,   290,   294,   295,   296,
     297,   298,   214,     3,   332,    63,   248,   174,   197,   257,
      91,   235,   236,   113,   193,   215,   215,   215,     3,   205,
     206,   254,   266,   271,   272,   260,   249,   261,   262,   272,
     260,   272,   115,   272,   119,   319,   320,   321,   270,   291,
     269,   313,     3,   244,     3,   169,   170,   171,   221,   222,
     223,   230,   125,   193,   195,   193,   193,   193,   112,   272,
     280,    46,   121,   273,   191,   273,   248,   272,   116,   132,
      17,    54,   101,   121,   128,   129,   136,   137,   174,   175,
     176,   177,   178,   181,   182,   184,   185,   186,   187,   188,
     189,   191,    98,   194,   197,   193,   272,   243,    39,   193,
      24,    49,   216,   257,   193,   194,   197,    94,   255,   256,
     197,     3,   125,   317,   318,   265,   245,   197,    90,   117,
     263,   265,    55,    55,    62,   134,   161,   172,   322,   321,
     125,   193,    93,    11,    25,    29,    30,    31,    32,    33,
      35,    43,    68,    86,    88,    89,   103,   108,   110,   120,
     153,   224,   193,   172,   172,   194,   197,   244,   194,   253,
       3,   186,   248,   291,   272,   272,   280,    92,   112,   118,
     193,   121,   266,   194,   194,   272,   272,   273,   273,   101,
     128,   193,   104,   121,   273,   273,   273,   273,   273,   273,
     273,   273,   273,   273,   273,   273,   273,   273,   273,   302,
     313,     3,   268,   233,   216,     4,   213,   194,   197,   268,
     206,   193,   307,   308,   309,   310,   311,   313,   328,   257,
     271,     3,   262,   319,   272,   272,   172,   161,   130,   158,
     159,   323,   224,   332,   214,   193,   193,   226,   193,   193,
     193,   225,   104,   121,   169,   170,   173,   227,   228,   229,
     231,   332,   193,   193,   222,    77,   284,   266,   194,    94,
     125,   109,    92,   118,   272,   272,   248,   192,   116,   273,
     193,   248,   266,   104,   192,   194,     3,   194,    24,    49,
     194,   244,    26,    66,    71,    78,    79,    95,   100,   329,
     197,   125,   315,   316,   317,    69,   258,    62,   332,   160,
     194,   194,     6,     6,     6,     6,     6,   104,   172,   313,
     229,   231,   194,   332,   332,   193,   194,   272,   224,   272,
     272,   118,   109,   194,   273,   248,   266,   194,   194,     4,
     213,   194,    99,    78,    78,    78,    99,   308,     3,   126,
     323,   194,   194,   197,   194,   194,   194,   240,   194,   194,
     105,   285,   284,   194,   194,   118,   272,   194,   194,   316,
     309,   308,   193,   266,     6,   231,   126,   260,    82,   131,
     332,    51,   259,   194,   266,   162,   163,   164,   286,   287,
     193,   272,   330,   194,   272,   194,     6,    17,   165,   168,
     288,   332,   166,   167,   288,   166,   167,   194,   116,   288
};

  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const yytype_int16 yyr1[] =
{
       0,   199,   200,   201,   201,   202,   202,   202,   202,   202,
     203,   203,   203,   203,   203,   203,   203,   203,   203,   203,
     204,   204,   205,   205,   206,   206,   207,   207,   207,   208,
     208,   209,   210,   211,   211,   212,   212,   213,   214,   215,
     215,   215,   216,   216,   216,   216,   217,   217,   218,   218,
     218,   219,   219,   219,   219,   219,   220,   220,   221,   221,
     222,   222,   223,   224,   224,   224,   224,   224,   224,   224,
     224,   224,   224,   224,   224,   224,   224,   224,   224,   224,
     224,   225,   225,   226,   226,   226,   227,   227,   228,   228,
     228,   228,   229,   229,   229,   229,   230,   230,   230,   231,
     232,   232,   232,   232,   233,   233,   234,   235,   236,   237,
     238,   239,   239,   240,   240,   241,   242,   242,   243,   244,
     244,   244,   245,   245,   246,   246,   247,   247,   248,   248,
     249,   250,   250,   250,   251,   251,   252,   253,   253,   254,
     255,   255,   256,   257,   257,   258,   258,   259,   259,   260,
     260,   261,   261,   262,   263,   263,   263,   264,   264,   265,
     265,   265,   265,   265,   265,   266,   266,   267,   267,   268,
     268,   269,   269,   270,   270,   270,   271,   272,   272,   272,
     272,   272,   273,   273,   273,   273,   273,   273,   273,   273,
     273,   273,   273,   274,   274,   275,   275,   275,   275,   275,
     276,   276,   276,   276,   276,   276,   276,   276,   276,   276,
     276,   277,   277,   278,   278,   278,   278,   279,   279,   279,
     279,   280,   280,   281,   281,   282,   282,   282,   282,   282,
     282,   282,   283,   283,   284,   284,   285,   285,   286,   286,
     286,   287,   287,   287,   288,   288,   288,   288,   288,   289,
     290,   291,   291,   291,   291,   291,   291,   292,   292,   292,
     292,   292,   292,   293,   293,   294,   295,   296,   297,   297,
     297,   297,   298,   298,   298,   298,   298,   298,   298,   299,
     300,   300,   301,   301,   302,   303,   304,   305,   305,   305,
     306,   307,   307,   308,   308,   309,   309,   310,   310,   311,
     312,   313,   313,   314,   314,   315,   315,   316,   316,   317,
     317,   318,   318,   319,   319,   320,   320,   321,   321,   322,
     322,   322,   322,   323,   323,   323,   324,   324,   325,   326,
     326,   327,   328,   328,   328,   329,   329,   329,   329,   329,
     329,   329,   329,   329,   329,   330,   331,   331,   332,   332
};

  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
static const yytype_int8 yyr2[] =
{
       0,     2,     2,     1,     3,     2,     2,     1,     1,     1,
       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
       5,     0,     1,     3,     1,     4,     2,     2,     2,     1,
       0,     4,     1,     2,     5,     7,     6,     1,     1,     4,
       3,     0,     4,     2,     4,     2,     5,     5,     2,     3,
       2,     8,     7,     6,     9,     7,     3,     0,     1,     3,
       1,     1,     3,     1,     1,     4,     4,     1,     1,     2,
       1,     1,     1,     1,     1,     1,     1,     1,     2,     1,
       4,     3,     0,     5,     3,     0,     1,     0,     1,     2,
       1,     2,     2,     1,     1,     2,     5,     4,     6,     3,
       4,     4,     3,     4,     2,     0,     5,     1,     4,     4,
       2,     8,     5,     3,     0,     5,     1,     3,     3,     2,
       2,     6,     1,     1,     1,     3,     3,     3,     4,     6,
       2,     1,     1,     1,     1,     0,     7,     1,     0,     1,
       1,     0,     2,     2,     0,     4,     0,     2,     0,     3,
       0,     1,     3,     2,     1,     1,     0,     2,     0,     2,
       2,     4,     2,     4,     0,     1,     3,     1,     0,     1,
       3,     1,     6,     1,     2,     2,     2,     1,     1,     1,
       1,     1,     3,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     3,     1,     1,     2,     2,     2,     3,     4,
       1,     3,     3,     3,     3,     3,     3,     3,     4,     3,
       3,     3,     3,     5,     6,     5,     6,     4,     6,     3,
       5,     4,     5,     4,     5,     3,     3,     3,     3,     3,
       3,     3,     4,     6,     6,     0,     3,     0,     2,     5,
       0,     1,     1,     1,     2,     2,     2,     2,     1,     6,
       6,     1,     1,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     1,     1,     1,     4,     4,     5,     1,     3,
       1,     3,     1,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     1,     1,     1,     1,     2,     2,     3,     2,
       1,     1,     3,     1,     1,     1,     4,     1,     3,     2,
       1,     1,     3,     1,     0,     1,     5,     1,     0,     2,
       1,     1,     0,     1,     0,     1,     2,     3,     5,     1,
       3,     1,     2,     2,     1,     0,     1,     0,     2,     1,
       3,     3,     4,     6,     8,     1,     2,     1,     2,     1,
       2,     1,     1,     1,     0,     1,     1,     0,     1,     3
};


#define yyerrok         (yyerrstatus = 0)
#define yyclearin       (yychar = YYEMPTY)
#define YYEMPTY         (-2)
#define YYEOF           0

#define YYACCEPT        goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrorlab


#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)                                    \
  do                                                              \
    if (yychar == YYEMPTY)                                        \
      {                                                           \
        yychar = (Token);                                         \
        yylval = (Value);                                         \
        YYPOPSTACK (yylen);                                       \
        yystate = *yyssp;                                         \
        goto yybackup;                                            \
      }                                                           \
    else                                                          \
      {                                                           \
        yyerror (&yylloc, result, scanner, YY_("syntax error: cannot back up")); \
        YYERROR;                                                  \
      }                                                           \
  while (0)

/* Error token number */
#define YYTERROR        1
#define YYERRCODE       256


/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
   If N is 0, then set CURRENT to the empty location which ends
   the previous symbol: RHS[0] (always defined).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
    do                                                                  \
      if (N)                                                            \
        {                                                               \
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
        }                                                               \
      else                                                              \
        {                                                               \
          (Current).first_line   = (Current).last_line   =              \
            YYRHSLOC (Rhs, 0).last_line;                                \
          (Current).first_column = (Current).last_column =              \
            YYRHSLOC (Rhs, 0).last_column;                              \
        }                                                               \
    while (0)
#endif

#define YYRHSLOC(Rhs, K) ((Rhs)[K])


/* Enable debugging if requested.  */
#if HSQL_DEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)                        \
do {                                            \
  if (yydebug)                                  \
    YYFPRINTF Args;                             \
} while (0)


/* YY_LOCATION_PRINT -- Print the location on the stream.
   This macro was not mandated originally: define only if we know
   we won't break user code: when these are the locations we know.  */

#ifndef YY_LOCATION_PRINT
# if defined HSQL_LTYPE_IS_TRIVIAL && HSQL_LTYPE_IS_TRIVIAL

/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */

YY_ATTRIBUTE_UNUSED
static int
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
{
  int res = 0;
  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
  if (0 <= yylocp->first_line)
    {
      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
      if (0 <= yylocp->first_column)
        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
    }
  if (0 <= yylocp->last_line)
    {
      if (yylocp->first_line < yylocp->last_line)
        {
          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
          if (0 <= end_col)
            res += YYFPRINTF (yyo, ".%d", end_col);
        }
      else if (0 <= end_col && yylocp->first_column < end_col)
        res += YYFPRINTF (yyo, "-%d", end_col);
    }
  return res;
 }

#  define YY_LOCATION_PRINT(File, Loc)          \
  yy_location_print_ (File, &(Loc))

# else
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif


# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
do {                                                                      \
  if (yydebug)                                                            \
    {                                                                     \
      YYFPRINTF (stderr, "%s ", Title);                                   \
      yy_symbol_print (stderr,                                            \
                  Type, Value, Location, result, scanner); \
      YYFPRINTF (stderr, "\n");                                           \
    }                                                                     \
} while (0)


/*-----------------------------------.
| Print this symbol's value on YYO.  |
`-----------------------------------*/

static void
yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, kmsql::SQLParserResult* result, yyscan_t scanner)
{
  FILE *yyoutput = yyo;
  YYUSE (yyoutput);
  YYUSE (yylocationp);
  YYUSE (result);
  YYUSE (scanner);
  if (!yyvaluep)
    return;
# ifdef YYPRINT
  if (yytype < YYNTOKENS)
    YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  YYUSE (yytype);
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}


/*---------------------------.
| Print this symbol on YYO.  |
`---------------------------*/

static void
yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, kmsql::SQLParserResult* result, yyscan_t scanner)
{
  YYFPRINTF (yyo, "%s %s (",
             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);

  YY_LOCATION_PRINT (yyo, *yylocationp);
  YYFPRINTF (yyo, ": ");
  yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, result, scanner);
  YYFPRINTF (yyo, ")");
}

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

static void
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
{
  YYFPRINTF (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      YYFPRINTF (stderr, " %d", yybot);
    }
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)                            \
do {                                                            \
  if (yydebug)                                                  \
    yy_stack_print ((Bottom), (Top));                           \
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

static void
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, kmsql::SQLParserResult* result, yyscan_t scanner)
{
  int yylno = yyrline[yyrule];
  int yynrhs = yyr2[yyrule];
  int yyi;
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
             yyrule - 1, yylno);
  /* The symbols being reduced.  */
  for (yyi = 0; yyi < yynrhs; yyi++)
    {
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
      yy_symbol_print (stderr,
                       yystos[+yyssp[yyi + 1 - yynrhs]],
                       &yyvsp[(yyi + 1) - (yynrhs)]
                       , &(yylsp[(yyi + 1) - (yynrhs)])                       , result, scanner);
      YYFPRINTF (stderr, "\n");
    }
}

# define YY_REDUCE_PRINT(Rule)          \
do {                                    \
  if (yydebug)                          \
    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, result, scanner); \
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !HSQL_DEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !HSQL_DEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif

/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   if the built-in stack extension method is used).

   Do not make this value too large; the results are undefined if
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif


#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined __GLIBC__ && defined _STRING_H
#   define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
#  else
/* Return the length of YYSTR.  */
static YYPTRDIFF_T
yystrlen (const char *yystr)
{
  YYPTRDIFF_T yylen;
  for (yylen = 0; yystr[yylen]; yylen++)
    continue;
  return yylen;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
yystpcpy (char *yydest, const char *yysrc)
{
  char *yyd = yydest;
  const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   quotes and backslashes, so that it's suitable for yyerror.  The
   heuristic is that double-quoting is unnecessary unless the string
   contains an apostrophe, a comma, or backslash (other than
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   null, do not copy; instead, return the length of what the result
   would have been.  */
static YYPTRDIFF_T
yytnamerr (char *yyres, const char *yystr)
{
  if (*yystr == '"')
    {
      YYPTRDIFF_T yyn = 0;
      char const *yyp = yystr;

      for (;;)
        switch (*++yyp)
          {
          case '\'':
          case ',':
            goto do_not_strip_quotes;

          case '\\':
            if (*++yyp != '\\')
              goto do_not_strip_quotes;
            else
              goto append;

          append:
          default:
            if (yyres)
              yyres[yyn] = *yyp;
            yyn++;
            break;

          case '"':
            if (yyres)
              yyres[yyn] = '\0';
            return yyn;
          }
    do_not_strip_quotes: ;
    }

  if (yyres)
    return yystpcpy (yyres, yystr) - yyres;
  else
    return yystrlen (yystr);
}
# endif

/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
   about the unexpected token YYTOKEN for the state stack whose top is
   YYSSP.

   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
   not large enough to hold the message.  In that case, also set
   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
   required number of bytes is too large to store.  */
static int
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
                yy_state_t *yyssp, int yytoken)
{
  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  /* Internationalized format string. */
  const char *yyformat = YY_NULLPTR;
  /* Arguments of yyformat: reported tokens (one for the "unexpected",
     one per "expected"). */
  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  /* Actual size of YYARG. */
  int yycount = 0;
  /* Cumulated lengths of YYARG.  */
  YYPTRDIFF_T yysize = 0;

  /* There are many possibilities here to consider:
     - If this state is a consistent state with a default action, then
       the only way this function was invoked is if the default action
       is an error action.  In that case, don't check for expected
       tokens because there are none.
     - The only way there can be no lookahead present (in yychar) is if
       this state is a consistent state with a default action.  Thus,
       detecting the absence of a lookahead is sufficient to determine
       that there is no unexpected or expected token to report.  In that
       case, just report a simple "syntax error".
     - Don't assume there isn't a lookahead just because this state is a
       consistent state with a default action.  There might have been a
       previous inconsistent state, consistent state with a non-default
       action, or user semantic action that manipulated yychar.
     - Of course, the expected token list depends on states to have
       correct lookahead information, and it depends on the parser not
       to perform extra reductions after fetching a lookahead from the
       scanner and before detecting a syntax error.  Thus, state merging
       (from LALR or IELR) and default reductions corrupt the expected
       token list.  However, the list is correct for canonical LR with
       one exception: it will still contain any token that will not be
       accepted due to an error action in a later state.
  */
  if (yytoken != YYEMPTY)
    {
      int yyn = yypact[+*yyssp];
      YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
      yysize = yysize0;
      yyarg[yycount++] = yytname[yytoken];
      if (!yypact_value_is_default (yyn))
        {
          /* Start YYX at -YYN if negative to avoid negative indexes in
             YYCHECK.  In other words, skip the first -YYN actions for
             this state because they are default actions.  */
          int yyxbegin = yyn < 0 ? -yyn : 0;
          /* Stay within bounds of both yycheck and yytname.  */
          int yychecklim = YYLAST - yyn + 1;
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
          int yyx;

          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
                && !yytable_value_is_error (yytable[yyx + yyn]))
              {
                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
                  {
                    yycount = 1;
                    yysize = yysize0;
                    break;
                  }
                yyarg[yycount++] = yytname[yyx];
                {
                  YYPTRDIFF_T yysize1
                    = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
                  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
                    yysize = yysize1;
                  else
                    return 2;
                }
              }
        }
    }

  switch (yycount)
    {
# define YYCASE_(N, S)                      \
      case N:                               \
        yyformat = S;                       \
      break
    default: /* Avoid compiler warnings. */
      YYCASE_(0, YY_("syntax error"));
      YYCASE_(1, YY_("syntax error, unexpected %s"));
      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
    }

  {
    /* Don't count the "%s"s in the final size, but reserve room for
       the terminator.  */
    YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
    if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
      yysize = yysize1;
    else
      return 2;
  }

  if (*yymsg_alloc < yysize)
    {
      *yymsg_alloc = 2 * yysize;
      if (! (yysize <= *yymsg_alloc
             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
      return 1;
    }

  /* Avoid sprintf, as that infringes on the user's name space.
     Don't have undefined behavior even if the translation
     produced a string with the wrong number of "%s"s.  */
  {
    char *yyp = *yymsg;
    int yyi = 0;
    while ((*yyp = *yyformat) != '\0')
      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
        {
          yyp += yytnamerr (yyp, yyarg[yyi++]);
          yyformat += 2;
        }
      else
        {
          ++yyp;
          ++yyformat;
        }
  }
  return 0;
}
#endif /* YYERROR_VERBOSE */

/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, kmsql::SQLParserResult* result, yyscan_t scanner)
{
  YYUSE (yyvaluep);
  YYUSE (yylocationp);
  YYUSE (result);
  YYUSE (scanner);
  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  switch (yytype)
    {
    case 3: /* IDENTIFIER  */
#line 192 "bison_parser.y"
            { free(((*yyvaluep).sval)); }
#line 2035 "bison_parser.cc"
        break;

    case 4: /* STRING  */
#line 192 "bison_parser.y"
            { free(((*yyvaluep).sval)); }
#line 2041 "bison_parser.cc"
        break;

    case 5: /* FLOATVAL  */
#line 179 "bison_parser.y"
            { }
#line 2047 "bison_parser.cc"
        break;

    case 6: /* INTVAL  */
#line 179 "bison_parser.y"
            { }
#line 2053 "bison_parser.cc"
        break;

    case 201: /* statement_list  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).stmt_vec)) {
    for (auto ptr : *(((*yyvaluep).stmt_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).stmt_vec));
}
#line 2066 "bison_parser.cc"
        break;

    case 202: /* statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).statement)); }
#line 2072 "bison_parser.cc"
        break;

    case 203: /* preparable_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).statement)); }
#line 2078 "bison_parser.cc"
        break;

    case 204: /* opt_hints  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).expr_vec)) {
    for (auto ptr : *(((*yyvaluep).expr_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).expr_vec));
}
#line 2091 "bison_parser.cc"
        break;

    case 205: /* hint_list  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).expr_vec)) {
    for (auto ptr : *(((*yyvaluep).expr_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).expr_vec));
}
#line 2104 "bison_parser.cc"
        break;

    case 206: /* hint  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2110 "bison_parser.cc"
        break;

    case 207: /* transaction_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).transaction_stmt)); }
#line 2116 "bison_parser.cc"
        break;

    case 209: /* prepare_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).prep_stmt)); }
#line 2122 "bison_parser.cc"
        break;

    case 210: /* prepare_target_query  */
#line 192 "bison_parser.y"
            { free(((*yyvaluep).sval)); }
#line 2128 "bison_parser.cc"
        break;

    case 211: /* execute_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).exec_stmt)); }
#line 2134 "bison_parser.cc"
        break;

    case 212: /* import_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).import_stmt)); }
#line 2140 "bison_parser.cc"
        break;

    case 213: /* file_type  */
#line 179 "bison_parser.y"
            { }
#line 2146 "bison_parser.cc"
        break;

    case 214: /* file_path  */
#line 192 "bison_parser.y"
            { free(((*yyvaluep).sval)); }
#line 2152 "bison_parser.cc"
        break;

    case 215: /* opt_import_export_options  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).import_export_option_t)); }
#line 2158 "bison_parser.cc"
        break;

    case 216: /* import_export_options  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).import_export_option_t)); }
#line 2164 "bison_parser.cc"
        break;

    case 217: /* export_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).export_stmt)); }
#line 2170 "bison_parser.cc"
        break;

    case 218: /* show_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).show_stmt)); }
#line 2176 "bison_parser.cc"
        break;

    case 219: /* create_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).create_stmt)); }
#line 2182 "bison_parser.cc"
        break;

    case 220: /* opt_not_exists  */
#line 179 "bison_parser.y"
            { }
#line 2188 "bison_parser.cc"
        break;

    case 221: /* table_elem_commalist  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).table_element_vec)) {
    for (auto ptr : *(((*yyvaluep).table_element_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).table_element_vec));
}
#line 2201 "bison_parser.cc"
        break;

    case 222: /* table_elem  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table_element_t)); }
#line 2207 "bison_parser.cc"
        break;

    case 223: /* column_def  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).column_t)); }
#line 2213 "bison_parser.cc"
        break;

    case 224: /* column_type  */
#line 179 "bison_parser.y"
            { }
#line 2219 "bison_parser.cc"
        break;

    case 225: /* opt_time_precision  */
#line 179 "bison_parser.y"
            { }
#line 2225 "bison_parser.cc"
        break;

    case 226: /* opt_decimal_specification  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).ival_pair)); }
#line 2231 "bison_parser.cc"
        break;

    case 227: /* opt_column_constraints  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).column_constraints_t)); }
#line 2237 "bison_parser.cc"
        break;

    case 228: /* column_constraints  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).column_constraints_t)); }
#line 2243 "bison_parser.cc"
        break;

    case 229: /* column_constraint  */
#line 179 "bison_parser.y"
            { }
#line 2249 "bison_parser.cc"
        break;

    case 230: /* table_constraint  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table_constraint_t)); }
#line 2255 "bison_parser.cc"
        break;

    case 231: /* references_spec  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).references_spec_t)); }
#line 2261 "bison_parser.cc"
        break;

    case 232: /* drop_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).drop_stmt)); }
#line 2267 "bison_parser.cc"
        break;

    case 233: /* opt_exists  */
#line 179 "bison_parser.y"
            { }
#line 2273 "bison_parser.cc"
        break;

    case 234: /* alter_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).alter_stmt)); }
#line 2279 "bison_parser.cc"
        break;

    case 235: /* alter_action  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).alter_action_t)); }
#line 2285 "bison_parser.cc"
        break;

    case 236: /* drop_action  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).drop_action_t)); }
#line 2291 "bison_parser.cc"
        break;

    case 237: /* delete_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).delete_stmt)); }
#line 2297 "bison_parser.cc"
        break;

    case 238: /* truncate_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).delete_stmt)); }
#line 2303 "bison_parser.cc"
        break;

    case 239: /* insert_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).insert_stmt)); }
#line 2309 "bison_parser.cc"
        break;

    case 240: /* opt_column_list  */
#line 184 "bison_parser.y"
            {
  if (((*yyvaluep).str_vec)) {
    for (auto ptr : *(((*yyvaluep).str_vec))) {
      free(ptr);
    }
  }
  delete (((*yyvaluep).str_vec));
}
#line 2322 "bison_parser.cc"
        break;

    case 241: /* update_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).update_stmt)); }
#line 2328 "bison_parser.cc"
        break;

    case 242: /* update_clause_commalist  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).update_vec)) {
    for (auto ptr : *(((*yyvaluep).update_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).update_vec));
}
#line 2341 "bison_parser.cc"
        break;

    case 243: /* update_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).update_t)); }
#line 2347 "bison_parser.cc"
        break;

    case 244: /* select_statement  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).select_stmt)); }
#line 2353 "bison_parser.cc"
        break;

    case 245: /* select_within_set_operation  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).select_stmt)); }
#line 2359 "bison_parser.cc"
        break;

    case 246: /* select_within_set_operation_no_parentheses  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).select_stmt)); }
#line 2365 "bison_parser.cc"
        break;

    case 247: /* select_with_paren  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).select_stmt)); }
#line 2371 "bison_parser.cc"
        break;

    case 248: /* select_no_paren  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).select_stmt)); }
#line 2377 "bison_parser.cc"
        break;

    case 249: /* set_operator  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).set_operator_t)); }
#line 2383 "bison_parser.cc"
        break;

    case 250: /* set_type  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).set_operator_t)); }
#line 2389 "bison_parser.cc"
        break;

    case 251: /* opt_all  */
#line 179 "bison_parser.y"
            { }
#line 2395 "bison_parser.cc"
        break;

    case 252: /* select_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).select_stmt)); }
#line 2401 "bison_parser.cc"
        break;

    case 253: /* opt_distinct  */
#line 179 "bison_parser.y"
            { }
#line 2407 "bison_parser.cc"
        break;

    case 254: /* select_list  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).expr_vec)) {
    for (auto ptr : *(((*yyvaluep).expr_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).expr_vec));
}
#line 2420 "bison_parser.cc"
        break;

    case 255: /* opt_from_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table)); }
#line 2426 "bison_parser.cc"
        break;

    case 256: /* from_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table)); }
#line 2432 "bison_parser.cc"
        break;

    case 257: /* opt_where  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2438 "bison_parser.cc"
        break;

    case 258: /* opt_group  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).group_t)); }
#line 2444 "bison_parser.cc"
        break;

    case 259: /* opt_having  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2450 "bison_parser.cc"
        break;

    case 260: /* opt_order  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).order_vec)) {
    for (auto ptr : *(((*yyvaluep).order_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).order_vec));
}
#line 2463 "bison_parser.cc"
        break;

    case 261: /* order_list  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).order_vec)) {
    for (auto ptr : *(((*yyvaluep).order_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).order_vec));
}
#line 2476 "bison_parser.cc"
        break;

    case 262: /* order_desc  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).order)); }
#line 2482 "bison_parser.cc"
        break;

    case 263: /* opt_order_type  */
#line 179 "bison_parser.y"
            { }
#line 2488 "bison_parser.cc"
        break;

    case 264: /* opt_top  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).limit)); }
#line 2494 "bison_parser.cc"
        break;

    case 265: /* opt_limit  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).limit)); }
#line 2500 "bison_parser.cc"
        break;

    case 266: /* expr_list  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).expr_vec)) {
    for (auto ptr : *(((*yyvaluep).expr_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).expr_vec));
}
#line 2513 "bison_parser.cc"
        break;

    case 267: /* opt_extended_literal_list  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).expr_vec)) {
    for (auto ptr : *(((*yyvaluep).expr_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).expr_vec));
}
#line 2526 "bison_parser.cc"
        break;

    case 268: /* extended_literal_list  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).expr_vec)) {
    for (auto ptr : *(((*yyvaluep).expr_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).expr_vec));
}
#line 2539 "bison_parser.cc"
        break;

    case 269: /* casted_extended_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2545 "bison_parser.cc"
        break;

    case 270: /* extended_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2551 "bison_parser.cc"
        break;

    case 271: /* expr_alias  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2557 "bison_parser.cc"
        break;

    case 272: /* expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2563 "bison_parser.cc"
        break;

    case 273: /* operand  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2569 "bison_parser.cc"
        break;

    case 274: /* scalar_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2575 "bison_parser.cc"
        break;

    case 275: /* unary_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2581 "bison_parser.cc"
        break;

    case 276: /* binary_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2587 "bison_parser.cc"
        break;

    case 277: /* logic_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2593 "bison_parser.cc"
        break;

    case 278: /* in_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2599 "bison_parser.cc"
        break;

    case 279: /* case_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2605 "bison_parser.cc"
        break;

    case 280: /* case_list  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2611 "bison_parser.cc"
        break;

    case 281: /* exists_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2617 "bison_parser.cc"
        break;

    case 282: /* comp_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2623 "bison_parser.cc"
        break;

    case 283: /* function_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2629 "bison_parser.cc"
        break;

    case 284: /* opt_window  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).window_description)); }
#line 2635 "bison_parser.cc"
        break;

    case 285: /* opt_partition  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).expr_vec)) {
    for (auto ptr : *(((*yyvaluep).expr_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).expr_vec));
}
#line 2648 "bison_parser.cc"
        break;

    case 286: /* opt_frame_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).frame_description)); }
#line 2654 "bison_parser.cc"
        break;

    case 287: /* frame_type  */
#line 179 "bison_parser.y"
            { }
#line 2660 "bison_parser.cc"
        break;

    case 288: /* frame_bound  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).frame_bound)); }
#line 2666 "bison_parser.cc"
        break;

    case 289: /* extract_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2672 "bison_parser.cc"
        break;

    case 290: /* cast_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2678 "bison_parser.cc"
        break;

    case 291: /* datetime_field  */
#line 179 "bison_parser.y"
            { }
#line 2684 "bison_parser.cc"
        break;

    case 292: /* datetime_field_plural  */
#line 179 "bison_parser.y"
            { }
#line 2690 "bison_parser.cc"
        break;

    case 293: /* duration_field  */
#line 179 "bison_parser.y"
            { }
#line 2696 "bison_parser.cc"
        break;

    case 294: /* array_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2702 "bison_parser.cc"
        break;

    case 295: /* array_index  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2708 "bison_parser.cc"
        break;

    case 296: /* between_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2714 "bison_parser.cc"
        break;

    case 297: /* column_name  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2720 "bison_parser.cc"
        break;

    case 298: /* literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2726 "bison_parser.cc"
        break;

    case 299: /* string_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2732 "bison_parser.cc"
        break;

    case 300: /* bool_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2738 "bison_parser.cc"
        break;

    case 301: /* num_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2744 "bison_parser.cc"
        break;

    case 302: /* int_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2750 "bison_parser.cc"
        break;

    case 303: /* null_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2756 "bison_parser.cc"
        break;

    case 304: /* date_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2762 "bison_parser.cc"
        break;

    case 305: /* interval_literal  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2768 "bison_parser.cc"
        break;

    case 306: /* param_expr  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2774 "bison_parser.cc"
        break;

    case 307: /* table_ref  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table)); }
#line 2780 "bison_parser.cc"
        break;

    case 308: /* table_ref_atomic  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table)); }
#line 2786 "bison_parser.cc"
        break;

    case 309: /* nonjoin_table_ref_atomic  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table)); }
#line 2792 "bison_parser.cc"
        break;

    case 310: /* table_ref_commalist  */
#line 193 "bison_parser.y"
            {
  if (((*yyvaluep).table_vec)) {
    for (auto ptr : *(((*yyvaluep).table_vec))) {
      delete ptr;
    }
  }
  delete (((*yyvaluep).table_vec));
}
#line 2805 "bison_parser.cc"
        break;

    case 311: /* table_ref_name  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table)); }
#line 2811 "bison_parser.cc"
        break;

    case 312: /* table_ref_name_no_alias  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table)); }
#line 2817 "bison_parser.cc"
        break;

    case 313: /* table_name  */
#line 180 "bison_parser.y"
            {
  free(((*yyvaluep).table_name).name);
  free(((*yyvaluep).table_name).schema);
}
#line 2826 "bison_parser.cc"
        break;

    case 314: /* opt_index_name  */
#line 192 "bison_parser.y"
            { free(((*yyvaluep).sval)); }
#line 2832 "bison_parser.cc"
        break;

    case 315: /* table_alias  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).alias_t)); }
#line 2838 "bison_parser.cc"
        break;

    case 316: /* opt_table_alias  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).alias_t)); }
#line 2844 "bison_parser.cc"
        break;

    case 317: /* alias  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).alias_t)); }
#line 2850 "bison_parser.cc"
        break;

    case 318: /* opt_alias  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).alias_t)); }
#line 2856 "bison_parser.cc"
        break;

    case 319: /* opt_locking_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).locking_clause_vec)); }
#line 2862 "bison_parser.cc"
        break;

    case 320: /* opt_locking_clause_list  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).locking_clause_vec)); }
#line 2868 "bison_parser.cc"
        break;

    case 321: /* locking_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).locking_t)); }
#line 2874 "bison_parser.cc"
        break;

    case 322: /* row_lock_mode  */
#line 179 "bison_parser.y"
            { }
#line 2880 "bison_parser.cc"
        break;

    case 323: /* opt_row_lock_policy  */
#line 179 "bison_parser.y"
            { }
#line 2886 "bison_parser.cc"
        break;

    case 324: /* opt_with_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).with_description_vec)); }
#line 2892 "bison_parser.cc"
        break;

    case 325: /* with_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).with_description_vec)); }
#line 2898 "bison_parser.cc"
        break;

    case 326: /* with_description_list  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).with_description_vec)); }
#line 2904 "bison_parser.cc"
        break;

    case 327: /* with_description  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).with_description_t)); }
#line 2910 "bison_parser.cc"
        break;

    case 328: /* join_clause  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).table)); }
#line 2916 "bison_parser.cc"
        break;

    case 329: /* opt_join_type  */
#line 179 "bison_parser.y"
            { }
#line 2922 "bison_parser.cc"
        break;

    case 330: /* join_condition  */
#line 201 "bison_parser.y"
            { delete (((*yyvaluep).expr)); }
#line 2928 "bison_parser.cc"
        break;

    case 332: /* ident_commalist  */
#line 184 "bison_parser.y"
            {
  if (((*yyvaluep).str_vec)) {
    for (auto ptr : *(((*yyvaluep).str_vec))) {
      free(ptr);
    }
  }
  delete (((*yyvaluep).str_vec));
}
#line 2941 "bison_parser.cc"
        break;

      default:
        break;
    }
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}




/*----------.
| yyparse.  |
`----------*/

int
yyparse (kmsql::SQLParserResult* result, yyscan_t scanner)
{
/* The lookahead symbol.  */
int yychar;


/* The semantic value of the lookahead symbol.  */
/* Default value used for initialization, for pacifying older GCCs
   or non-GCC compilers.  */
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);

/* Location data for the lookahead symbol.  */
static YYLTYPE yyloc_default
# if defined HSQL_LTYPE_IS_TRIVIAL && HSQL_LTYPE_IS_TRIVIAL
  = { 1, 1, 1, 1 }
# endif
;
YYLTYPE yylloc = yyloc_default;

    /* Number of syntax errors so far.  */
    int yynerrs;

    yy_state_fast_t yystate;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;

    /* The stacks and their tools:
       'yyss': related to states.
       'yyvs': related to semantic values.
       'yyls': related to locations.

       Refer to the stacks through separate pointers, to allow yyoverflow
       to reallocate them elsewhere.  */

    /* The state stack.  */
    yy_state_t yyssa[YYINITDEPTH];
    yy_state_t *yyss;
    yy_state_t *yyssp;

    /* The semantic value stack.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs;
    YYSTYPE *yyvsp;

    /* The location stack.  */
    YYLTYPE yylsa[YYINITDEPTH];
    YYLTYPE *yyls;
    YYLTYPE *yylsp;

    /* The locations where the error started and ended.  */
    YYLTYPE yyerror_range[3];

    YYPTRDIFF_T yystacksize;

  int yyn;
  int yyresult;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken = 0;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;
  YYLTYPE yyloc;

#if YYERROR_VERBOSE
  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
#endif

#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  yyssp = yyss = yyssa;
  yyvsp = yyvs = yyvsa;
  yylsp = yyls = yylsa;
  yystacksize = YYINITDEPTH;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY; /* Cause a token to be read.  */

/* User initialization code.  */
#line 81 "bison_parser.y"
{
  // Initialize
  yylloc.first_column = 0;
  yylloc.last_column = 0;
  yylloc.first_line = 0;
  yylloc.last_line = 0;
  yylloc.total_column = 0;
  yylloc.string_length = 0;
}

#line 3059 "bison_parser.cc"

  yylsp[0] = yylloc;
  goto yysetstate;


/*------------------------------------------------------------.
| yynewstate -- push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;


/*--------------------------------------------------------------------.
| yysetstate -- set current state (the top of the stack) to yystate.  |
`--------------------------------------------------------------------*/
yysetstate:
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
  YY_IGNORE_USELESS_CAST_BEGIN
  *yyssp = YY_CAST (yy_state_t, yystate);
  YY_IGNORE_USELESS_CAST_END

  if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
    goto yyexhaustedlab;
#else
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYPTRDIFF_T yysize = yyssp - yyss + 1;

# if defined yyoverflow
      {
        /* Give user a chance to reallocate the stack.  Use copies of
           these so that the &'s don't force the real ones into
           memory.  */
        yy_state_t *yyss1 = yyss;
        YYSTYPE *yyvs1 = yyvs;
        YYLTYPE *yyls1 = yyls;

        /* Each stack pointer address is followed by the size of the
           data in use in that stack, in bytes.  This used to be a
           conditional around just the two extra args, but that might
           be undefined if yyoverflow is a macro.  */
        yyoverflow (YY_("memory exhausted"),
                    &yyss1, yysize * YYSIZEOF (*yyssp),
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
                    &yyls1, yysize * YYSIZEOF (*yylsp),
                    &yystacksize);
        yyss = yyss1;
        yyvs = yyvs1;
        yyls = yyls1;
      }
# else /* defined YYSTACK_RELOCATE */
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
        goto yyexhaustedlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
        yystacksize = YYMAXDEPTH;

      {
        yy_state_t *yyss1 = yyss;
        union yyalloc *yyptr =
          YY_CAST (union yyalloc *,
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
        if (! yyptr)
          goto yyexhaustedlab;
        YYSTACK_RELOCATE (yyss_alloc, yyss);
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
        YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
      }
# endif

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
      yylsp = yyls + yysize - 1;

      YY_IGNORE_USELESS_CAST_BEGIN
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
                  YY_CAST (long, yystacksize)));
      YY_IGNORE_USELESS_CAST_END

      if (yyss + yystacksize - 1 <= yyssp)
        YYABORT;
    }
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */

  if (yystate == YYFINAL)
    YYACCEPT;

  goto yybackup;


/*-----------.
| yybackup.  |
`-----------*/
yybackup:
  /* Do appropriate processing given the current state.  Read a
     lookahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yypact_value_is_default (yyn))
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = yylex (&yylval, &yylloc, scanner);
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yytable_value_is_error (yyn))
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  yystate = yyn;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END
  *++yylsp = yylloc;

  /* Discard the shifted token.  */
  yychar = YYEMPTY;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     '$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];

  /* Default location. */
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  yyerror_range[1] = yyloc;
  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
  case 2:
#line 335 "bison_parser.y"
                                     {
  for (SQLStatement* stmt : *(yyvsp[-1].stmt_vec)) {
    // Transfers ownership of the statement.
    result->addStatement(stmt);
  }

  unsigned param_id = 0;
  for (void* param : yyloc.param_list) {
    if (param) {
      Expr* expr = (Expr*)param;
      expr->ival = param_id;
      result->addParameter(expr);
      ++param_id;
    }
  }
    delete (yyvsp[-1].stmt_vec);
  }
#line 3274 "bison_parser.cc"
    break;

  case 3:
#line 354 "bison_parser.y"
                           {
  (yyvsp[0].statement)->stringLength = yylloc.string_length;
  yylloc.string_length = 0;
  (yyval.stmt_vec) = new std::vector<SQLStatement*>();
  (yyval.stmt_vec)->push_back((yyvsp[0].statement));
}
#line 3285 "bison_parser.cc"
    break;

  case 4:
#line 360 "bison_parser.y"
                               {
  (yyvsp[0].statement)->stringLength = yylloc.string_length;
  yylloc.string_length = 0;
  (yyvsp[-2].stmt_vec)->push_back((yyvsp[0].statement));
  (yyval.stmt_vec) = (yyvsp[-2].stmt_vec);
}
#line 3296 "bison_parser.cc"
    break;

  case 5:
#line 367 "bison_parser.y"
                                        {
  (yyval.statement) = (yyvsp[-1].prep_stmt);
  (yyval.statement)->hints = (yyvsp[0].expr_vec);
}
#line 3305 "bison_parser.cc"
    break;

  case 6:
#line 371 "bison_parser.y"
                                 {
  (yyval.statement) = (yyvsp[-1].statement);
  (yyval.statement)->hints = (yyvsp[0].expr_vec);
}
#line 3314 "bison_parser.cc"
    break;

  case 7:
#line 375 "bison_parser.y"
                 { (yyval.statement) = (yyvsp[0].show_stmt); }
#line 3320 "bison_parser.cc"
    break;

  case 8:
#line 376 "bison_parser.y"
                   { (yyval.statement) = (yyvsp[0].import_stmt); }
#line 3326 "bison_parser.cc"
    break;

  case 9:
#line 377 "bison_parser.y"
                   { (yyval.statement) = (yyvsp[0].export_stmt); }
#line 3332 "bison_parser.cc"
    break;

  case 10:
#line 379 "bison_parser.y"
                                        { (yyval.statement) = (yyvsp[0].select_stmt); }
#line 3338 "bison_parser.cc"
    break;

  case 11:
#line 380 "bison_parser.y"
                   { (yyval.statement) = (yyvsp[0].create_stmt); }
#line 3344 "bison_parser.cc"
    break;

  case 12:
#line 381 "bison_parser.y"
                   { (yyval.statement) = (yyvsp[0].insert_stmt); }
#line 3350 "bison_parser.cc"
    break;

  case 13:
#line 382 "bison_parser.y"
                   { (yyval.statement) = (yyvsp[0].delete_stmt); }
#line 3356 "bison_parser.cc"
    break;

  case 14:
#line 383 "bison_parser.y"
                     { (yyval.statement) = (yyvsp[0].delete_stmt); }
#line 3362 "bison_parser.cc"
    break;

  case 15:
#line 384 "bison_parser.y"
                   { (yyval.statement) = (yyvsp[0].update_stmt); }
#line 3368 "bison_parser.cc"
    break;

  case 16:
#line 385 "bison_parser.y"
                 { (yyval.statement) = (yyvsp[0].drop_stmt); }
#line 3374 "bison_parser.cc"
    break;

  case 17:
#line 386 "bison_parser.y"
                  { (yyval.statement) = (yyvsp[0].alter_stmt); }
#line 3380 "bison_parser.cc"
    break;

  case 18:
#line 387 "bison_parser.y"
                    { (yyval.statement) = (yyvsp[0].exec_stmt); }
#line 3386 "bison_parser.cc"
    break;

  case 19:
#line 388 "bison_parser.y"
                        { (yyval.statement) = (yyvsp[0].transaction_stmt); }
#line 3392 "bison_parser.cc"
    break;

  case 20:
#line 394 "bison_parser.y"
                                        { (yyval.expr_vec) = (yyvsp[-1].expr_vec); }
#line 3398 "bison_parser.cc"
    break;

  case 21:
#line 395 "bison_parser.y"
              { (yyval.expr_vec) = nullptr; }
#line 3404 "bison_parser.cc"
    break;

  case 22:
#line 397 "bison_parser.y"
                 {
  (yyval.expr_vec) = new std::vector<Expr*>();
  (yyval.expr_vec)->push_back((yyvsp[0].expr));
}
#line 3413 "bison_parser.cc"
    break;

  case 23:
#line 401 "bison_parser.y"
                     {
  (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr));
  (yyval.expr_vec) = (yyvsp[-2].expr_vec);
}
#line 3422 "bison_parser.cc"
    break;

  case 24:
#line 406 "bison_parser.y"
                  {
  (yyval.expr) = Expr::make(kExprHint);
  (yyval.expr)->name = (yyvsp[0].sval);
}
#line 3431 "bison_parser.cc"
    break;

  case 25:
#line 410 "bison_parser.y"
                                           {
  (yyval.expr) = Expr::make(kExprHint);
  (yyval.expr)->name = (yyvsp[-3].sval);
  (yyval.expr)->exprList = (yyvsp[-1].expr_vec);
}
#line 3441 "bison_parser.cc"
    break;

  case 26:
#line 420 "bison_parser.y"
                                                      { (yyval.transaction_stmt) = new TransactionStatement(kBeginTransaction); }
#line 3447 "bison_parser.cc"
    break;

  case 27:
#line 421 "bison_parser.y"
                                   { (yyval.transaction_stmt) = new TransactionStatement(kRollbackTransaction); }
#line 3453 "bison_parser.cc"
    break;

  case 28:
#line 422 "bison_parser.y"
                                 { (yyval.transaction_stmt) = new TransactionStatement(kCommitTransaction); }
#line 3459 "bison_parser.cc"
    break;

  case 31:
#line 430 "bison_parser.y"
                                                                 {
  (yyval.prep_stmt) = new PrepareStatement();
  (yyval.prep_stmt)->name = (yyvsp[-2].sval);
  (yyval.prep_stmt)->query = (yyvsp[0].sval);
}
#line 3469 "bison_parser.cc"
    break;

  case 33:
#line 438 "bison_parser.y"
                                       {
  (yyval.exec_stmt) = new ExecuteStatement();
  (yyval.exec_stmt)->name = (yyvsp[0].sval);
}
#line 3478 "bison_parser.cc"
    break;

  case 34:
#line 442 "bison_parser.y"
                                                       {
  (yyval.exec_stmt) = new ExecuteStatement();
  (yyval.exec_stmt)->name = (yyvsp[-3].sval);
  (yyval.exec_stmt)->parameters = (yyvsp[-1].expr_vec);
}
#line 3488 "bison_parser.cc"
    break;

  case 35:
#line 454 "bison_parser.y"
                                                                        {
  (yyval.import_stmt) = new ImportStatement((yyvsp[-4].import_type_t));
  (yyval.import_stmt)->filePath = (yyvsp[-2].sval);
  (yyval.import_stmt)->schema = (yyvsp[0].table_name).schema;
  (yyval.import_stmt)->tableName = (yyvsp[0].table_name).name;
}
#line 3499 "bison_parser.cc"
    break;

  case 36:
#line 460 "bison_parser.y"
                                                                     {
  (yyval.import_stmt) = new ImportStatement((yyvsp[-1].import_export_option_t)->format);
  (yyval.import_stmt)->filePath = (yyvsp[-2].sval);
  (yyval.import_stmt)->schema = (yyvsp[-4].table_name).schema;
  (yyval.import_stmt)->tableName = (yyvsp[-4].table_name).name;
  (yyval.import_stmt)->whereClause = (yyvsp[0].expr);
  if ((yyvsp[-1].import_export_option_t)->encoding) {
    (yyval.import_stmt)->encoding = (yyvsp[-1].import_export_option_t)->encoding;
    (yyvsp[-1].import_export_option_t)->encoding = nullptr;
  }
  delete (yyvsp[-1].import_export_option_t);
}
#line 3516 "bison_parser.cc"
    break;

  case 37:
#line 473 "bison_parser.y"
                       {
  if (strcasecmp((yyvsp[0].sval), "csv") == 0) {
    (yyval.import_type_t) = kImportCSV;
  } else if (strcasecmp((yyvsp[0].sval), "tbl") == 0) {
    (yyval.import_type_t) = kImportTbl;
  } else if (strcasecmp((yyvsp[0].sval), "binary") == 0 || strcasecmp((yyvsp[0].sval), "bin") == 0) {
    (yyval.import_type_t) = kImportBinary;
  } else {
    free((yyvsp[0].sval));
    yyerror(&yyloc, result, scanner, "File type is unknown.");
    YYERROR;
  }
  free((yyvsp[0].sval));
}
#line 3535 "bison_parser.cc"
    break;

  case 38:
#line 488 "bison_parser.y"
                   { (yyval.sval) = (yyvsp[0].sval); }
#line 3541 "bison_parser.cc"
    break;

  case 39:
#line 490 "bison_parser.y"
                                                               { (yyval.import_export_option_t) = (yyvsp[-1].import_export_option_t); }
#line 3547 "bison_parser.cc"
    break;

  case 40:
#line 491 "bison_parser.y"
                                { (yyval.import_export_option_t) = (yyvsp[-1].import_export_option_t); }
#line 3553 "bison_parser.cc"
    break;

  case 41:
#line 492 "bison_parser.y"
              { (yyval.import_export_option_t) = new ImportExportOptions{}; }
#line 3559 "bison_parser.cc"
    break;

  case 42:
#line 494 "bison_parser.y"
                                                                   {
  if ((yyvsp[-3].import_export_option_t)->format != kImportAuto) {
    delete (yyvsp[-3].import_export_option_t);
    yyerror(&yyloc, result, scanner, "File type must only be provided once.");
    YYERROR;
  }
  (yyvsp[-3].import_export_option_t)->format = (yyvsp[0].import_type_t);
  (yyval.import_export_option_t) = (yyvsp[-3].import_export_option_t);
}
#line 3573 "bison_parser.cc"
    break;

  case 43:
#line 503 "bison_parser.y"
                   {
  (yyval.import_export_option_t) = new ImportExportOptions{};
  (yyval.import_export_option_t)->format = (yyvsp[0].import_type_t);
}
#line 3582 "bison_parser.cc"
    break;

  case 44:
#line 507 "bison_parser.y"
                                            {
  if ((yyvsp[-3].import_export_option_t)->encoding) {
    delete (yyvsp[-3].import_export_option_t);
    free((yyvsp[0].sval));
    yyerror(&yyloc, result, scanner, "Encoding type must only be provided once.");
    YYERROR;
  }
  (yyvsp[-3].import_export_option_t)->encoding = (yyvsp[0].sval);
  (yyval.import_export_option_t) = (yyvsp[-3].import_export_option_t);
}
#line 3597 "bison_parser.cc"
    break;

  case 45:
#line 517 "bison_parser.y"
                  {
  (yyval.import_export_option_t) = new ImportExportOptions{};
  (yyval.import_export_option_t)->encoding = (yyvsp[0].sval);
}
#line 3606 "bison_parser.cc"
    break;

  case 46:
#line 527 "bison_parser.y"
                                                                          {
  (yyval.export_stmt) = new ExportStatement((yyvsp[0].import_export_option_t)->format);
  (yyval.export_stmt)->filePath = (yyvsp[-1].sval);
  (yyval.export_stmt)->schema = (yyvsp[-3].table_name).schema;
  (yyval.export_stmt)->tableName = (yyvsp[-3].table_name).name;
  if ((yyvsp[0].import_export_option_t)->encoding) {
    (yyval.export_stmt)->encoding = (yyvsp[0].import_export_option_t)->encoding;
    (yyvsp[0].import_export_option_t)->encoding = nullptr;
  }
  delete (yyvsp[0].import_export_option_t);
}
#line 3622 "bison_parser.cc"
    break;

  case 47:
#line 538 "bison_parser.y"
                                                                {
  (yyval.export_stmt) = new ExportStatement((yyvsp[0].import_export_option_t)->format);
  (yyval.export_stmt)->filePath = (yyvsp[-1].sval);
  (yyval.export_stmt)->select = (yyvsp[-3].select_stmt);
  if ((yyvsp[0].import_export_option_t)->encoding) {
    (yyval.export_stmt)->encoding = (yyvsp[0].import_export_option_t)->encoding;
    (yyvsp[0].import_export_option_t)->encoding = nullptr;
  }
  delete (yyvsp[0].import_export_option_t);
}
#line 3637 "bison_parser.cc"
    break;

  case 48:
#line 554 "bison_parser.y"
                             { (yyval.show_stmt) = new ShowStatement(kShowTables); }
#line 3643 "bison_parser.cc"
    break;

  case 49:
#line 555 "bison_parser.y"
                          {
  (yyval.show_stmt) = new ShowStatement(kShowColumns);
  (yyval.show_stmt)->schema = (yyvsp[0].table_name).schema;
  (yyval.show_stmt)->name = (yyvsp[0].table_name).name;
}
#line 3653 "bison_parser.cc"
    break;

  case 50:
#line 560 "bison_parser.y"
                      {
  (yyval.show_stmt) = new ShowStatement(kShowColumns);
  (yyval.show_stmt)->schema = (yyvsp[0].table_name).schema;
  (yyval.show_stmt)->name = (yyvsp[0].table_name).name;
}
#line 3663 "bison_parser.cc"
    break;

  case 51:
#line 571 "bison_parser.y"
                                                                                         {
  (yyval.create_stmt) = new CreateStatement(kCreateTableFromTbl);
  (yyval.create_stmt)->ifNotExists = (yyvsp[-5].bval);
  (yyval.create_stmt)->schema = (yyvsp[-4].table_name).schema;
  (yyval.create_stmt)->tableName = (yyvsp[-4].table_name).name;
  if (strcasecmp((yyvsp[-2].sval), "tbl") != 0) {
    free((yyvsp[-2].sval));
    yyerror(&yyloc, result, scanner, "File type is unknown.");
    YYERROR;
  }
  free((yyvsp[-2].sval));
  (yyval.create_stmt)->filePath = (yyvsp[0].sval);
}
#line 3681 "bison_parser.cc"
    break;

  case 52:
#line 584 "bison_parser.y"
                                                                      {
  (yyval.create_stmt) = new CreateStatement(kCreateTable);
  (yyval.create_stmt)->ifNotExists = (yyvsp[-4].bval);
  (yyval.create_stmt)->schema = (yyvsp[-3].table_name).schema;
  (yyval.create_stmt)->tableName = (yyvsp[-3].table_name).name;
  (yyval.create_stmt)->setColumnDefsAndConstraints((yyvsp[-1].table_element_vec));
  delete (yyvsp[-1].table_element_vec);
  if (result->errorMsg()) {
    delete (yyval.create_stmt);
    YYERROR;
  }
}
#line 3698 "bison_parser.cc"
    break;

  case 53:
#line 596 "bison_parser.y"
                                                             {
  (yyval.create_stmt) = new CreateStatement(kCreateTable);
  (yyval.create_stmt)->ifNotExists = (yyvsp[-3].bval);
  (yyval.create_stmt)->schema = (yyvsp[-2].table_name).schema;
  (yyval.create_stmt)->tableName = (yyvsp[-2].table_name).name;
  (yyval.create_stmt)->select = (yyvsp[0].select_stmt);
}
#line 3710 "bison_parser.cc"
    break;

  case 54:
#line 603 "bison_parser.y"
                                                                                   {
  (yyval.create_stmt) = new CreateStatement(kCreateIndex);
  (yyval.create_stmt)->indexName = (yyvsp[-5].sval);
  (yyval.create_stmt)->ifNotExists = (yyvsp[-6].bval);
  (yyval.create_stmt)->tableName = (yyvsp[-3].table_name).name;
  (yyval.create_stmt)->indexColumns = (yyvsp[-1].str_vec);
}
#line 3722 "bison_parser.cc"
    break;

  case 55:
#line 610 "bison_parser.y"
                                                                            {
  (yyval.create_stmt) = new CreateStatement(kCreateView);
  (yyval.create_stmt)->ifNotExists = (yyvsp[-4].bval);
  (yyval.create_stmt)->schema = (yyvsp[-3].table_name).schema;
  (yyval.create_stmt)->tableName = (yyvsp[-3].table_name).name;
  (yyval.create_stmt)->viewColumns = (yyvsp[-2].str_vec);
  (yyval.create_stmt)->select = (yyvsp[0].select_stmt);
}
#line 3735 "bison_parser.cc"
    break;

  case 56:
#line 619 "bison_parser.y"
                               { (yyval.bval) = true; }
#line 3741 "bison_parser.cc"
    break;

  case 57:
#line 620 "bison_parser.y"
              { (yyval.bval) = false; }
#line 3747 "bison_parser.cc"
    break;

  case 58:
#line 622 "bison_parser.y"
                                  {
  (yyval.table_element_vec) = new std::vector<TableElement*>();
  (yyval.table_element_vec)->push_back((yyvsp[0].table_element_t));
}
#line 3756 "bison_parser.cc"
    break;

  case 59:
#line 626 "bison_parser.y"
                                      {
  (yyvsp[-2].table_element_vec)->push_back((yyvsp[0].table_element_t));
  (yyval.table_element_vec) = (yyvsp[-2].table_element_vec);
}
#line 3765 "bison_parser.cc"
    break;

  case 60:
#line 631 "bison_parser.y"
                        { (yyval.table_element_t) = (yyvsp[0].column_t); }
#line 3771 "bison_parser.cc"
    break;

  case 61:
#line 632 "bison_parser.y"
                   { (yyval.table_element_t) = (yyvsp[0].table_constraint_t); }
#line 3777 "bison_parser.cc"
    break;

  case 62:
#line 634 "bison_parser.y"
                                                           {
  (yyval.column_t) = new ColumnDefinition((yyvsp[-2].sval), (yyvsp[-1].column_type_t), (yyvsp[0].column_constraints_t)->constraints, (yyvsp[0].column_constraints_t)->references);
  if (!(yyval.column_t)->trySetNullableExplicit()) {
    yyerror(&yyloc, result, scanner, ("Conflicting nullability constraints for " + std::string{(yyvsp[-2].sval)}).c_str());
  }
  delete (yyvsp[0].column_constraints_t);
}
#line 3789 "bison_parser.cc"
    break;

  case 63:
#line 642 "bison_parser.y"
                     { (yyval.column_type_t) = ColumnType{DataType::BIGINT}; }
#line 3795 "bison_parser.cc"
    break;

  case 64:
#line 643 "bison_parser.y"
          { (yyval.column_type_t) = ColumnType{DataType::BOOLEAN}; }
#line 3801 "bison_parser.cc"
    break;

  case 65:
#line 644 "bison_parser.y"
                      { (yyval.column_type_t) = ColumnType{DataType::CHAR, (yyvsp[-1].ival)}; }
#line 3807 "bison_parser.cc"
    break;

  case 66:
#line 645 "bison_parser.y"
                                   { (yyval.column_type_t) = ColumnType{DataType::VARCHAR, (yyvsp[-1].ival)}; }
#line 3813 "bison_parser.cc"
    break;

  case 67:
#line 646 "bison_parser.y"
       { (yyval.column_type_t) = ColumnType{DataType::DATE}; }
#line 3819 "bison_parser.cc"
    break;

  case 68:
#line 647 "bison_parser.y"
           { (yyval.column_type_t) = ColumnType{DataType::DATETIME}; }
#line 3825 "bison_parser.cc"
    break;

  case 69:
#line 648 "bison_parser.y"
                                    {
  (yyval.column_type_t) = ColumnType{DataType::DECIMAL, 0, (yyvsp[0].ival_pair)->first, (yyvsp[0].ival_pair)->second};
  delete (yyvsp[0].ival_pair);
}
#line 3834 "bison_parser.cc"
    break;

  case 70:
#line 652 "bison_parser.y"
         { (yyval.column_type_t) = ColumnType{DataType::DOUBLE}; }
#line 3840 "bison_parser.cc"
    break;

  case 71:
#line 653 "bison_parser.y"
        { (yyval.column_type_t) = ColumnType{DataType::FLOAT}; }
#line 3846 "bison_parser.cc"
    break;

  case 72:
#line 654 "bison_parser.y"
      { (yyval.column_type_t) = ColumnType{DataType::INT}; }
#line 3852 "bison_parser.cc"
    break;

  case 73:
#line 655 "bison_parser.y"
          { (yyval.column_type_t) = ColumnType{DataType::INT}; }
#line 3858 "bison_parser.cc"
    break;

  case 74:
#line 656 "bison_parser.y"
       { (yyval.column_type_t) = ColumnType{DataType::LONG}; }
#line 3864 "bison_parser.cc"
    break;

  case 75:
#line 657 "bison_parser.y"
       { (yyval.column_type_t) = ColumnType{DataType::REAL}; }
#line 3870 "bison_parser.cc"
    break;

  case 76:
#line 658 "bison_parser.y"
           { (yyval.column_type_t) = ColumnType{DataType::SMALLINT}; }
#line 3876 "bison_parser.cc"
    break;

  case 77:
#line 659 "bison_parser.y"
       { (yyval.column_type_t) = ColumnType{DataType::TEXT}; }
#line 3882 "bison_parser.cc"
    break;

  case 78:
#line 660 "bison_parser.y"
                          { (yyval.column_type_t) = ColumnType{DataType::TIME, 0, (yyvsp[0].ival)}; }
#line 3888 "bison_parser.cc"
    break;

  case 79:
#line 661 "bison_parser.y"
            { (yyval.column_type_t) = ColumnType{DataType::DATETIME}; }
#line 3894 "bison_parser.cc"
    break;

  case 80:
#line 662 "bison_parser.y"
                         { (yyval.column_type_t) = ColumnType{DataType::VARCHAR, (yyvsp[-1].ival)}; }
#line 3900 "bison_parser.cc"
    break;

  case 81:
#line 664 "bison_parser.y"
                                    { (yyval.ival) = (yyvsp[-1].ival); }
#line 3906 "bison_parser.cc"
    break;

  case 82:
#line 665 "bison_parser.y"
              { (yyval.ival) = 0; }
#line 3912 "bison_parser.cc"
    break;

  case 83:
#line 667 "bison_parser.y"
                                                      { (yyval.ival_pair) = new std::pair<int64_t, int64_t>{(yyvsp[-3].ival), (yyvsp[-1].ival)}; }
#line 3918 "bison_parser.cc"
    break;

  case 84:
#line 668 "bison_parser.y"
                 { (yyval.ival_pair) = new std::pair<int64_t, int64_t>{(yyvsp[-1].ival), 0}; }
#line 3924 "bison_parser.cc"
    break;

  case 85:
#line 669 "bison_parser.y"
              { (yyval.ival_pair) = new std::pair<int64_t, int64_t>{0, 0}; }
#line 3930 "bison_parser.cc"
    break;

  case 86:
#line 671 "bison_parser.y"
                                            { (yyval.column_constraints_t) = (yyvsp[0].column_constraints_t); }
#line 3936 "bison_parser.cc"
    break;

  case 87:
#line 672 "bison_parser.y"
              { (yyval.column_constraints_t) = new ColumnConstraints(); }
#line 3942 "bison_parser.cc"
    break;

  case 88:
#line 674 "bison_parser.y"
                                       {
  (yyval.column_constraints_t) = new ColumnConstraints();
  (yyval.column_constraints_t)->constraints->insert((yyvsp[0].column_constraint_t));
}
#line 3951 "bison_parser.cc"
    break;

  case 89:
#line 678 "bison_parser.y"
                                       {
  (yyvsp[-1].column_constraints_t)->constraints->insert((yyvsp[0].column_constraint_t));
  (yyval.column_constraints_t) = (yyvsp[-1].column_constraints_t);
}
#line 3960 "bison_parser.cc"
    break;

  case 90:
#line 682 "bison_parser.y"
                  {
  (yyval.column_constraints_t) = new ColumnConstraints();
  (yyval.column_constraints_t)->constraints->insert(ConstraintType::ForeignKey);
  (yyval.column_constraints_t)->references->emplace_back((yyvsp[0].references_spec_t));
}
#line 3970 "bison_parser.cc"
    break;

  case 91:
#line 687 "bison_parser.y"
                                     {
  // Multiple foreign keys for the same column could be possible, so we do not raise an error in that case.
  // Think of foreign keys referenced on multiple levels (returned item references sold item references items).
  (yyvsp[-1].column_constraints_t)->constraints->insert(ConstraintType::ForeignKey);
  (yyvsp[-1].column_constraints_t)->references->emplace_back((yyvsp[0].references_spec_t));
  (yyval.column_constraints_t) = (yyvsp[-1].column_constraints_t);
}
#line 3982 "bison_parser.cc"
    break;

  case 92:
#line 695 "bison_parser.y"
                                { (yyval.column_constraint_t) = ConstraintType::PrimaryKey; }
#line 3988 "bison_parser.cc"
    break;

  case 93:
#line 696 "bison_parser.y"
         { (yyval.column_constraint_t) = ConstraintType::Unique; }
#line 3994 "bison_parser.cc"
    break;

  case 94:
#line 697 "bison_parser.y"
       { (yyval.column_constraint_t) = ConstraintType::Null; }
#line 4000 "bison_parser.cc"
    break;

  case 95:
#line 698 "bison_parser.y"
           { (yyval.column_constraint_t) = ConstraintType::NotNull; }
#line 4006 "bison_parser.cc"
    break;

  case 96:
#line 700 "bison_parser.y"
                                                       { (yyval.table_constraint_t) = new TableConstraint(ConstraintType::PrimaryKey, (yyvsp[-1].str_vec)); }
#line 4012 "bison_parser.cc"
    break;

  case 97:
#line 701 "bison_parser.y"
                                 { (yyval.table_constraint_t) = new TableConstraint(ConstraintType::Unique, (yyvsp[-1].str_vec)); }
#line 4018 "bison_parser.cc"
    break;

  case 98:
#line 702 "bison_parser.y"
                                                      { (yyval.table_constraint_t) = new ForeignKeyConstraint((yyvsp[-2].str_vec), (yyvsp[0].references_spec_t)); }
#line 4024 "bison_parser.cc"
    break;

  case 99:
#line 704 "bison_parser.y"
                                                        { (yyval.references_spec_t) = new ReferencesSpecification((yyvsp[-1].table_name).schema, (yyvsp[-1].table_name).name, (yyvsp[0].str_vec)); }
#line 4030 "bison_parser.cc"
    break;

  case 100:
#line 712 "bison_parser.y"
                                                  {
  (yyval.drop_stmt) = new DropStatement(kDropTable);
  (yyval.drop_stmt)->ifExists = (yyvsp[-1].bval);
  (yyval.drop_stmt)->schema = (yyvsp[0].table_name).schema;
  (yyval.drop_stmt)->name = (yyvsp[0].table_name).name;
}
#line 4041 "bison_parser.cc"
    break;

  case 101:
#line 718 "bison_parser.y"
                                  {
  (yyval.drop_stmt) = new DropStatement(kDropView);
  (yyval.drop_stmt)->ifExists = (yyvsp[-1].bval);
  (yyval.drop_stmt)->schema = (yyvsp[0].table_name).schema;
  (yyval.drop_stmt)->name = (yyvsp[0].table_name).name;
}
#line 4052 "bison_parser.cc"
    break;

  case 102:
#line 724 "bison_parser.y"
                                {
  (yyval.drop_stmt) = new DropStatement(kDropPreparedStatement);
  (yyval.drop_stmt)->ifExists = false;
  (yyval.drop_stmt)->name = (yyvsp[0].sval);
}
#line 4062 "bison_parser.cc"
    break;

  case 103:
#line 730 "bison_parser.y"
                                   {
  (yyval.drop_stmt) = new DropStatement(kDropIndex);
  (yyval.drop_stmt)->ifExists = (yyvsp[-1].bval);
  (yyval.drop_stmt)->indexName = (yyvsp[0].sval);
}
#line 4072 "bison_parser.cc"
    break;

  case 104:
#line 736 "bison_parser.y"
                       { (yyval.bval) = true; }
#line 4078 "bison_parser.cc"
    break;

  case 105:
#line 737 "bison_parser.y"
              { (yyval.bval) = false; }
#line 4084 "bison_parser.cc"
    break;

  case 106:
#line 744 "bison_parser.y"
                                                                 {
  (yyval.alter_stmt) = new AlterStatement((yyvsp[-1].table_name).name, (yyvsp[0].alter_action_t));
  (yyval.alter_stmt)->ifTableExists = (yyvsp[-2].bval);
  (yyval.alter_stmt)->schema = (yyvsp[-1].table_name).schema;
}
#line 4094 "bison_parser.cc"
    break;

  case 107:
#line 750 "bison_parser.y"
                           { (yyval.alter_action_t) = (yyvsp[0].drop_action_t); }
#line 4100 "bison_parser.cc"
    break;

  case 108:
#line 752 "bison_parser.y"
                                                {
  (yyval.drop_action_t) = new DropColumnAction((yyvsp[0].sval));
  (yyval.drop_action_t)->ifExists = (yyvsp[-1].bval);
}
#line 4109 "bison_parser.cc"
    break;

  case 109:
#line 762 "bison_parser.y"
                                                    {
  (yyval.delete_stmt) = new DeleteStatement();
  (yyval.delete_stmt)->schema = (yyvsp[-1].table_name).schema;
  (yyval.delete_stmt)->tableName = (yyvsp[-1].table_name).name;
  (yyval.delete_stmt)->expr = (yyvsp[0].expr);
}
#line 4120 "bison_parser.cc"
    break;

  case 110:
#line 769 "bison_parser.y"
                                         {
  (yyval.delete_stmt) = new DeleteStatement();
  (yyval.delete_stmt)->schema = (yyvsp[0].table_name).schema;
  (yyval.delete_stmt)->tableName = (yyvsp[0].table_name).name;
}
#line 4130 "bison_parser.cc"
    break;

  case 111:
#line 780 "bison_parser.y"
                                                                                               {
  (yyval.insert_stmt) = new InsertStatement(kInsertValues);
  (yyval.insert_stmt)->schema = (yyvsp[-5].table_name).schema;
  (yyval.insert_stmt)->tableName = (yyvsp[-5].table_name).name;
  (yyval.insert_stmt)->columns = (yyvsp[-4].str_vec);
  (yyval.insert_stmt)->values = (yyvsp[-1].expr_vec);
}
#line 4142 "bison_parser.cc"
    break;

  case 112:
#line 787 "bison_parser.y"
                                                         {
  (yyval.insert_stmt) = new InsertStatement(kInsertSelect);
  (yyval.insert_stmt)->schema = (yyvsp[-2].table_name).schema;
  (yyval.insert_stmt)->tableName = (yyvsp[-2].table_name).name;
  (yyval.insert_stmt)->columns = (yyvsp[-1].str_vec);
  (yyval.insert_stmt)->select = (yyvsp[0].select_stmt);
}
#line 4154 "bison_parser.cc"
    break;

  case 113:
#line 795 "bison_parser.y"
                                          { (yyval.str_vec) = (yyvsp[-1].str_vec); }
#line 4160 "bison_parser.cc"
    break;

  case 114:
#line 796 "bison_parser.y"
              { (yyval.str_vec) = nullptr; }
#line 4166 "bison_parser.cc"
    break;

  case 115:
#line 803 "bison_parser.y"
                                                                                        {
  (yyval.update_stmt) = new UpdateStatement();
  (yyval.update_stmt)->table = (yyvsp[-3].table);
  (yyval.update_stmt)->updates = (yyvsp[-1].update_vec);
  (yyval.update_stmt)->where = (yyvsp[0].expr);
}
#line 4177 "bison_parser.cc"
    break;

  case 116:
#line 810 "bison_parser.y"
                                        {
  (yyval.update_vec) = new std::vector<UpdateClause*>();
  (yyval.update_vec)->push_back((yyvsp[0].update_t));
}
#line 4186 "bison_parser.cc"
    break;

  case 117:
#line 814 "bison_parser.y"
                                            {
  (yyvsp[-2].update_vec)->push_back((yyvsp[0].update_t));
  (yyval.update_vec) = (yyvsp[-2].update_vec);
}
#line 4195 "bison_parser.cc"
    break;

  case 118:
#line 819 "bison_parser.y"
                                    {
  (yyval.update_t) = new UpdateClause();
  (yyval.update_t)->column = (yyvsp[-2].sval);
  (yyval.update_t)->value = (yyvsp[0].expr);
}
#line 4205 "bison_parser.cc"
    break;

  case 119:
#line 829 "bison_parser.y"
                                                     {
  (yyval.select_stmt) = (yyvsp[0].select_stmt);
  (yyval.select_stmt)->withDescriptions = (yyvsp[-1].with_description_vec);
}
#line 4214 "bison_parser.cc"
    break;

  case 120:
#line 833 "bison_parser.y"
                                  {
  (yyval.select_stmt) = (yyvsp[0].select_stmt);
  (yyval.select_stmt)->withDescriptions = (yyvsp[-1].with_description_vec);
}
#line 4223 "bison_parser.cc"
    break;

  case 121:
#line 837 "bison_parser.y"
                                                                                                 {
  (yyval.select_stmt) = (yyvsp[-4].select_stmt);
  if ((yyval.select_stmt)->setOperations == nullptr) {
    (yyval.select_stmt)->setOperations = new std::vector<SetOperation*>();
  }
  (yyval.select_stmt)->setOperations->push_back((yyvsp[-3].set_operator_t));
  (yyval.select_stmt)->setOperations->back()->nestedSelectStatement = (yyvsp[-2].select_stmt);
  (yyval.select_stmt)->setOperations->back()->resultOrder = (yyvsp[-1].order_vec);
  (yyval.select_stmt)->setOperations->back()->resultLimit = (yyvsp[0].limit);
  (yyval.select_stmt)->withDescriptions = (yyvsp[-5].with_description_vec);
}
#line 4239 "bison_parser.cc"
    break;

  case 124:
#line 851 "bison_parser.y"
                                                           { (yyval.select_stmt) = (yyvsp[0].select_stmt); }
#line 4245 "bison_parser.cc"
    break;

  case 125:
#line 852 "bison_parser.y"
                                                         {
  (yyval.select_stmt) = (yyvsp[-2].select_stmt);
  if ((yyval.select_stmt)->setOperations == nullptr) {
    (yyval.select_stmt)->setOperations = new std::vector<SetOperation*>();
  }
  (yyval.select_stmt)->setOperations->push_back((yyvsp[-1].set_operator_t));
  (yyval.select_stmt)->setOperations->back()->nestedSelectStatement = (yyvsp[0].select_stmt);
}
#line 4258 "bison_parser.cc"
    break;

  case 126:
#line 861 "bison_parser.y"
                                            { (yyval.select_stmt) = (yyvsp[-1].select_stmt); }
#line 4264 "bison_parser.cc"
    break;

  case 127:
#line 862 "bison_parser.y"
                            { (yyval.select_stmt) = (yyvsp[-1].select_stmt); }
#line 4270 "bison_parser.cc"
    break;

  case 128:
#line 864 "bison_parser.y"
                                                                       {
  (yyval.select_stmt) = (yyvsp[-3].select_stmt);
  (yyval.select_stmt)->order = (yyvsp[-2].order_vec);

  // Limit could have been set by TOP.
  if ((yyvsp[-1].limit)) {
    delete (yyval.select_stmt)->limit;
    (yyval.select_stmt)->limit = (yyvsp[-1].limit);
  }

  if ((yyvsp[0].locking_clause_vec)) {
    (yyval.select_stmt)->lockings = (yyvsp[0].locking_clause_vec);
  }
}
#line 4289 "bison_parser.cc"
    break;

  case 129:
#line 878 "bison_parser.y"
                                                                                                {
  (yyval.select_stmt) = (yyvsp[-5].select_stmt);
  if ((yyval.select_stmt)->setOperations == nullptr) {
    (yyval.select_stmt)->setOperations = new std::vector<SetOperation*>();
  }
  (yyval.select_stmt)->setOperations->push_back((yyvsp[-4].set_operator_t));
  (yyval.select_stmt)->setOperations->back()->nestedSelectStatement = (yyvsp[-3].select_stmt);
  (yyval.select_stmt)->setOperations->back()->resultOrder = (yyvsp[-2].order_vec);
  (yyval.select_stmt)->setOperations->back()->resultLimit = (yyvsp[-1].limit);
  (yyval.select_stmt)->lockings = (yyvsp[0].locking_clause_vec);
}
#line 4305 "bison_parser.cc"
    break;

  case 130:
#line 890 "bison_parser.y"
                                {
  (yyval.set_operator_t) = (yyvsp[-1].set_operator_t);
  (yyval.set_operator_t)->isAll = (yyvsp[0].bval);
}
#line 4314 "bison_parser.cc"
    break;

  case 131:
#line 895 "bison_parser.y"
                 {
  (yyval.set_operator_t) = new SetOperation();
  (yyval.set_operator_t)->setType = SetType::kSetUnion;
}
#line 4323 "bison_parser.cc"
    break;

  case 132:
#line 899 "bison_parser.y"
            {
  (yyval.set_operator_t) = new SetOperation();
  (yyval.set_operator_t)->setType = SetType::kSetIntersect;
}
#line 4332 "bison_parser.cc"
    break;

  case 133:
#line 903 "bison_parser.y"
         {
  (yyval.set_operator_t) = new SetOperation();
  (yyval.set_operator_t)->setType = SetType::kSetExcept;
}
#line 4341 "bison_parser.cc"
    break;

  case 134:
#line 908 "bison_parser.y"
              { (yyval.bval) = true; }
#line 4347 "bison_parser.cc"
    break;

  case 135:
#line 909 "bison_parser.y"
              { (yyval.bval) = false; }
#line 4353 "bison_parser.cc"
    break;

  case 136:
#line 911 "bison_parser.y"
                                                                                            {
  (yyval.select_stmt) = new SelectStatement();
  (yyval.select_stmt)->limit = (yyvsp[-5].limit);
  (yyval.select_stmt)->selectDistinct = (yyvsp[-4].bval);
  (yyval.select_stmt)->selectList = (yyvsp[-3].expr_vec);
  (yyval.select_stmt)->fromTable = (yyvsp[-2].table);
  (yyval.select_stmt)->whereClause = (yyvsp[-1].expr);
  (yyval.select_stmt)->groupBy = (yyvsp[0].group_t);
}
#line 4367 "bison_parser.cc"
    break;

  case 137:
#line 921 "bison_parser.y"
                        { (yyval.bval) = true; }
#line 4373 "bison_parser.cc"
    break;

  case 138:
#line 922 "bison_parser.y"
              { (yyval.bval) = false; }
#line 4379 "bison_parser.cc"
    break;

  case 140:
#line 926 "bison_parser.y"
                              { (yyval.table) = (yyvsp[0].table); }
#line 4385 "bison_parser.cc"
    break;

  case 141:
#line 927 "bison_parser.y"
              { (yyval.table) = nullptr; }
#line 4391 "bison_parser.cc"
    break;

  case 142:
#line 929 "bison_parser.y"
                             { (yyval.table) = (yyvsp[0].table); }
#line 4397 "bison_parser.cc"
    break;

  case 143:
#line 931 "bison_parser.y"
                       { (yyval.expr) = (yyvsp[0].expr); }
#line 4403 "bison_parser.cc"
    break;

  case 144:
#line 932 "bison_parser.y"
              { (yyval.expr) = nullptr; }
#line 4409 "bison_parser.cc"
    break;

  case 145:
#line 934 "bison_parser.y"
                                          {
  (yyval.group_t) = new GroupByDescription();
  (yyval.group_t)->columns = (yyvsp[-1].expr_vec);
  (yyval.group_t)->having = (yyvsp[0].expr);
}
#line 4419 "bison_parser.cc"
    break;

  case 146:
#line 939 "bison_parser.y"
              { (yyval.group_t) = nullptr; }
#line 4425 "bison_parser.cc"
    break;

  case 147:
#line 941 "bison_parser.y"
                         { (yyval.expr) = (yyvsp[0].expr); }
#line 4431 "bison_parser.cc"
    break;

  case 148:
#line 942 "bison_parser.y"
              { (yyval.expr) = nullptr; }
#line 4437 "bison_parser.cc"
    break;

  case 149:
#line 944 "bison_parser.y"
                                { (yyval.order_vec) = (yyvsp[0].order_vec); }
#line 4443 "bison_parser.cc"
    break;

  case 150:
#line 945 "bison_parser.y"
              { (yyval.order_vec) = nullptr; }
#line 4449 "bison_parser.cc"
    break;

  case 151:
#line 947 "bison_parser.y"
                        {
  (yyval.order_vec) = new std::vector<OrderDescription*>();
  (yyval.order_vec)->push_back((yyvsp[0].order));
}
#line 4458 "bison_parser.cc"
    break;

  case 152:
#line 951 "bison_parser.y"
                            {
  (yyvsp[-2].order_vec)->push_back((yyvsp[0].order));
  (yyval.order_vec) = (yyvsp[-2].order_vec);
}
#line 4467 "bison_parser.cc"
    break;

  case 153:
#line 956 "bison_parser.y"
                                 { (yyval.order) = new OrderDescription((yyvsp[0].order_type), (yyvsp[-1].expr)); }
#line 4473 "bison_parser.cc"
    break;

  case 154:
#line 958 "bison_parser.y"
                     { (yyval.order_type) = kOrderAsc; }
#line 4479 "bison_parser.cc"
    break;

  case 155:
#line 959 "bison_parser.y"
       { (yyval.order_type) = kOrderDesc; }
#line 4485 "bison_parser.cc"
    break;

  case 156:
#line 960 "bison_parser.y"
              { (yyval.order_type) = kOrderAsc; }
#line 4491 "bison_parser.cc"
    break;

  case 157:
#line 964 "bison_parser.y"
                          { (yyval.limit) = new LimitDescription((yyvsp[0].expr), nullptr); }
#line 4497 "bison_parser.cc"
    break;

  case 158:
#line 965 "bison_parser.y"
              { (yyval.limit) = nullptr; }
#line 4503 "bison_parser.cc"
    break;

  case 159:
#line 967 "bison_parser.y"
                       { (yyval.limit) = new LimitDescription((yyvsp[0].expr), nullptr); }
#line 4509 "bison_parser.cc"
    break;

  case 160:
#line 968 "bison_parser.y"
              { (yyval.limit) = new LimitDescription(nullptr, (yyvsp[0].expr)); }
#line 4515 "bison_parser.cc"
    break;

  case 161:
#line 969 "bison_parser.y"
                         { (yyval.limit) = new LimitDescription((yyvsp[-2].expr), (yyvsp[0].expr)); }
#line 4521 "bison_parser.cc"
    break;

  case 162:
#line 970 "bison_parser.y"
            { (yyval.limit) = new LimitDescription(nullptr, nullptr); }
#line 4527 "bison_parser.cc"
    break;

  case 163:
#line 971 "bison_parser.y"
                        { (yyval.limit) = new LimitDescription(nullptr, (yyvsp[0].expr)); }
#line 4533 "bison_parser.cc"
    break;

  case 164:
#line 972 "bison_parser.y"
              { (yyval.limit) = nullptr; }
#line 4539 "bison_parser.cc"
    break;

  case 165:
#line 977 "bison_parser.y"
                       {
  (yyval.expr_vec) = new std::vector<Expr*>();
  (yyval.expr_vec)->push_back((yyvsp[0].expr));
}
#line 4548 "bison_parser.cc"
    break;

  case 166:
#line 981 "bison_parser.y"
                           {
  (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr));
  (yyval.expr_vec) = (yyvsp[-2].expr_vec);
}
#line 4557 "bison_parser.cc"
    break;

  case 167:
#line 987 "bison_parser.y"
                                                  { (yyval.expr_vec) = (yyvsp[0].expr_vec); }
#line 4563 "bison_parser.cc"
    break;

  case 168:
#line 988 "bison_parser.y"
              { (yyval.expr_vec) = nullptr; }
#line 4569 "bison_parser.cc"
    break;

  case 169:
#line 990 "bison_parser.y"
                                                {
  (yyval.expr_vec) = new std::vector<Expr*>();
  (yyval.expr_vec)->push_back((yyvsp[0].expr));
}
#line 4578 "bison_parser.cc"
    break;

  case 170:
#line 994 "bison_parser.y"
                                                    {
  (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr));
  (yyval.expr_vec) = (yyvsp[-2].expr_vec);
}
#line 4587 "bison_parser.cc"
    break;

  case 172:
#line 999 "bison_parser.y"
                                                                                          {
  (yyval.expr) = Expr::makeCast((yyvsp[-3].expr), (yyvsp[-1].column_type_t));
}
#line 4595 "bison_parser.cc"
    break;

  case 173:
#line 1003 "bison_parser.y"
                           {
  if ((yyvsp[0].expr)->type == ExprType::kExprParameter) {
    delete (yyvsp[0].expr);
    yyerror(&yyloc, result, scanner, "Parameter ? is not a valid literal.");
    YYERROR;
  }
  (yyval.expr) = (yyvsp[0].expr);
}
#line 4608 "bison_parser.cc"
    break;

  case 174:
#line 1011 "bison_parser.y"
                  { (yyval.expr) = Expr::makeOpUnary(kOpUnaryMinus, (yyvsp[0].expr)); }
#line 4614 "bison_parser.cc"
    break;

  case 175:
#line 1012 "bison_parser.y"
                       { (yyval.expr) = Expr::makeOpUnary(kOpUnaryMinus, (yyvsp[0].expr)); }
#line 4620 "bison_parser.cc"
    break;

  case 176:
#line 1014 "bison_parser.y"
                            {
  (yyval.expr) = (yyvsp[-1].expr);
  if ((yyvsp[0].alias_t)) {
    (yyval.expr)->alias = (yyvsp[0].alias_t)->name;
    (yyvsp[0].alias_t)->name = nullptr;
    delete (yyvsp[0].alias_t);
  }
}
#line 4633 "bison_parser.cc"
    break;

  case 182:
#line 1025 "bison_parser.y"
                       { (yyval.expr) = (yyvsp[-1].expr); }
#line 4639 "bison_parser.cc"
    break;

  case 192:
#line 1027 "bison_parser.y"
                                         {
  (yyval.expr) = Expr::makeSelect((yyvsp[-1].select_stmt));
}
#line 4647 "bison_parser.cc"
    break;

  case 195:
#line 1033 "bison_parser.y"
                         { (yyval.expr) = Expr::makeOpUnary(kOpUnaryMinus, (yyvsp[0].expr)); }
#line 4653 "bison_parser.cc"
    break;

  case 196:
#line 1034 "bison_parser.y"
              { (yyval.expr) = Expr::makeOpUnary(kOpNot, (yyvsp[0].expr)); }
#line 4659 "bison_parser.cc"
    break;

  case 197:
#line 1035 "bison_parser.y"
                 { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-1].expr)); }
#line 4665 "bison_parser.cc"
    break;

  case 198:
#line 1036 "bison_parser.y"
                  { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-2].expr)); }
#line 4671 "bison_parser.cc"
    break;

  case 199:
#line 1037 "bison_parser.y"
                      { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeOpUnary(kOpIsNull, (yyvsp[-3].expr))); }
#line 4677 "bison_parser.cc"
    break;

  case 201:
#line 1039 "bison_parser.y"
                                              { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpMinus, (yyvsp[0].expr)); }
#line 4683 "bison_parser.cc"
    break;

  case 202:
#line 1040 "bison_parser.y"
                      { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPlus, (yyvsp[0].expr)); }
#line 4689 "bison_parser.cc"
    break;

  case 203:
#line 1041 "bison_parser.y"
                      { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpSlash, (yyvsp[0].expr)); }
#line 4695 "bison_parser.cc"
    break;

  case 204:
#line 1042 "bison_parser.y"
                      { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAsterisk, (yyvsp[0].expr)); }
#line 4701 "bison_parser.cc"
    break;

  case 205:
#line 1043 "bison_parser.y"
                      { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPercentage, (yyvsp[0].expr)); }
#line 4707 "bison_parser.cc"
    break;

  case 206:
#line 1044 "bison_parser.y"
                      { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpCaret, (yyvsp[0].expr)); }
#line 4713 "bison_parser.cc"
    break;

  case 207:
#line 1045 "bison_parser.y"
                       { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLike, (yyvsp[0].expr)); }
#line 4719 "bison_parser.cc"
    break;

  case 208:
#line 1046 "bison_parser.y"
                           { (yyval.expr) = Expr::makeOpBinary((yyvsp[-3].expr), kOpNotLike, (yyvsp[0].expr)); }
#line 4725 "bison_parser.cc"
    break;

  case 209:
#line 1047 "bison_parser.y"
                        { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpILike, (yyvsp[0].expr)); }
#line 4731 "bison_parser.cc"
    break;

  case 210:
#line 1048 "bison_parser.y"
                         { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpConcat, (yyvsp[0].expr)); }
#line 4737 "bison_parser.cc"
    break;

  case 211:
#line 1050 "bison_parser.y"
                           { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAnd, (yyvsp[0].expr)); }
#line 4743 "bison_parser.cc"
    break;

  case 212:
#line 1051 "bison_parser.y"
               { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpOr, (yyvsp[0].expr)); }
#line 4749 "bison_parser.cc"
    break;

  case 213:
#line 1053 "bison_parser.y"
                                       { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].expr_vec)); }
#line 4755 "bison_parser.cc"
    break;

  case 214:
#line 1054 "bison_parser.y"
                                   { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].expr_vec))); }
#line 4761 "bison_parser.cc"
    break;

  case 215:
#line 1055 "bison_parser.y"
                                     { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].select_stmt)); }
#line 4767 "bison_parser.cc"
    break;

  case 216:
#line 1056 "bison_parser.y"
                                         { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].select_stmt))); }
#line 4773 "bison_parser.cc"
    break;

  case 217:
#line 1060 "bison_parser.y"
                                    { (yyval.expr) = Expr::makeCase((yyvsp[-2].expr), (yyvsp[-1].expr), nullptr); }
#line 4779 "bison_parser.cc"
    break;

  case 218:
#line 1061 "bison_parser.y"
                                    { (yyval.expr) = Expr::makeCase((yyvsp[-4].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); }
#line 4785 "bison_parser.cc"
    break;

  case 219:
#line 1062 "bison_parser.y"
                     { (yyval.expr) = Expr::makeCase(nullptr, (yyvsp[-1].expr), nullptr); }
#line 4791 "bison_parser.cc"
    break;

  case 220:
#line 1063 "bison_parser.y"
                               { (yyval.expr) = Expr::makeCase(nullptr, (yyvsp[-3].expr), (yyvsp[-1].expr)); }
#line 4797 "bison_parser.cc"
    break;

  case 221:
#line 1065 "bison_parser.y"
                                { (yyval.expr) = Expr::makeCaseList(Expr::makeCaseListElement((yyvsp[-2].expr), (yyvsp[0].expr))); }
#line 4803 "bison_parser.cc"
    break;

  case 222:
#line 1066 "bison_parser.y"
                                { (yyval.expr) = Expr::caseListAppend((yyvsp[-4].expr), Expr::makeCaseListElement((yyvsp[-2].expr), (yyvsp[0].expr))); }
#line 4809 "bison_parser.cc"
    break;

  case 223:
#line 1068 "bison_parser.y"
                                             { (yyval.expr) = Expr::makeExists((yyvsp[-1].select_stmt)); }
#line 4815 "bison_parser.cc"
    break;

  case 224:
#line 1069 "bison_parser.y"
                                     { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeExists((yyvsp[-1].select_stmt))); }
#line 4821 "bison_parser.cc"
    break;

  case 225:
#line 1071 "bison_parser.y"
                                { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpEquals, (yyvsp[0].expr)); }
#line 4827 "bison_parser.cc"
    break;

  case 226:
#line 1072 "bison_parser.y"
                         { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpEquals, (yyvsp[0].expr)); }
#line 4833 "bison_parser.cc"
    break;

  case 227:
#line 1073 "bison_parser.y"
                            { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpNotEquals, (yyvsp[0].expr)); }
#line 4839 "bison_parser.cc"
    break;

  case 228:
#line 1074 "bison_parser.y"
                      { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLess, (yyvsp[0].expr)); }
#line 4845 "bison_parser.cc"
    break;

  case 229:
#line 1075 "bison_parser.y"
                      { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreater, (yyvsp[0].expr)); }
#line 4851 "bison_parser.cc"
    break;

  case 230:
#line 1076 "bison_parser.y"
                         { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLessEq, (yyvsp[0].expr)); }
#line 4857 "bison_parser.cc"
    break;

  case 231:
#line 1077 "bison_parser.y"
                            { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreaterEq, (yyvsp[0].expr)); }
#line 4863 "bison_parser.cc"
    break;

  case 232:
#line 1081 "bison_parser.y"
                                              { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-3].sval), new std::vector<Expr*>(), false, (yyvsp[0].window_description)); }
#line 4869 "bison_parser.cc"
    break;

  case 233:
#line 1082 "bison_parser.y"
                                                       { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-5].sval), (yyvsp[-2].expr_vec), (yyvsp[-3].bval), (yyvsp[0].window_description)); }
#line 4875 "bison_parser.cc"
    break;

  case 234:
#line 1086 "bison_parser.y"
                                                                   { (yyval.window_description) = new WindowDescription((yyvsp[-3].expr_vec), (yyvsp[-2].order_vec), (yyvsp[-1].frame_description)); }
#line 4881 "bison_parser.cc"
    break;

  case 235:
#line 1087 "bison_parser.y"
              { (yyval.window_description) = nullptr; }
#line 4887 "bison_parser.cc"
    break;

  case 236:
#line 1089 "bison_parser.y"
                                       { (yyval.expr_vec) = (yyvsp[0].expr_vec); }
#line 4893 "bison_parser.cc"
    break;

  case 237:
#line 1090 "bison_parser.y"
              { (yyval.expr_vec) = nullptr; }
#line 4899 "bison_parser.cc"
    break;

  case 238:
#line 1095 "bison_parser.y"
                                          { (yyval.frame_description) = new FrameDescription{(yyvsp[-1].frame_type), (yyvsp[0].frame_bound), new FrameBound{0, kCurrentRow, false}}; }
#line 4905 "bison_parser.cc"
    break;

  case 239:
#line 1096 "bison_parser.y"
                                                 { (yyval.frame_description) = new FrameDescription{(yyvsp[-4].frame_type), (yyvsp[-2].frame_bound), (yyvsp[0].frame_bound)}; }
#line 4911 "bison_parser.cc"
    break;

  case 240:
#line 1097 "bison_parser.y"
              {
  (yyval.frame_description) = new FrameDescription{kRange, new FrameBound{0, kPreceding, true}, new FrameBound{0, kCurrentRow, false}};
}
#line 4919 "bison_parser.cc"
    break;

  case 241:
#line 1101 "bison_parser.y"
                   { (yyval.frame_type) = kRange; }
#line 4925 "bison_parser.cc"
    break;

  case 242:
#line 1102 "bison_parser.y"
       { (yyval.frame_type) = kRows; }
#line 4931 "bison_parser.cc"
    break;

  case 243:
#line 1103 "bison_parser.y"
         { (yyval.frame_type) = kGroups; }
#line 4937 "bison_parser.cc"
    break;

  case 244:
#line 1105 "bison_parser.y"
                                  { (yyval.frame_bound) = new FrameBound{0, kPreceding, true}; }
#line 4943 "bison_parser.cc"
    break;

  case 245:
#line 1106 "bison_parser.y"
                   { (yyval.frame_bound) = new FrameBound{(yyvsp[-1].ival), kPreceding, false}; }
#line 4949 "bison_parser.cc"
    break;

  case 246:
#line 1107 "bison_parser.y"
                      { (yyval.frame_bound) = new FrameBound{0, kFollowing, true}; }
#line 4955 "bison_parser.cc"
    break;

  case 247:
#line 1108 "bison_parser.y"
                   { (yyval.frame_bound) = new FrameBound{(yyvsp[-1].ival), kFollowing, false}; }
#line 4961 "bison_parser.cc"
    break;

  case 248:
#line 1109 "bison_parser.y"
              { (yyval.frame_bound) = new FrameBound{0, kCurrentRow, false}; }
#line 4967 "bison_parser.cc"
    break;

  case 249:
#line 1111 "bison_parser.y"
                                                        { (yyval.expr) = Expr::makeExtract((yyvsp[-3].datetime_field), (yyvsp[-1].expr)); }
#line 4973 "bison_parser.cc"
    break;

  case 250:
#line 1113 "bison_parser.y"
                                             { (yyval.expr) = Expr::makeCast((yyvsp[-3].expr), (yyvsp[-1].column_type_t)); }
#line 4979 "bison_parser.cc"
    break;

  case 251:
#line 1115 "bison_parser.y"
                        { (yyval.datetime_field) = kDatetimeSecond; }
#line 4985 "bison_parser.cc"
    break;

  case 252:
#line 1116 "bison_parser.y"
         { (yyval.datetime_field) = kDatetimeMinute; }
#line 4991 "bison_parser.cc"
    break;

  case 253:
#line 1117 "bison_parser.y"
       { (yyval.datetime_field) = kDatetimeHour; }
#line 4997 "bison_parser.cc"
    break;

  case 254:
#line 1118 "bison_parser.y"
      { (yyval.datetime_field) = kDatetimeDay; }
#line 5003 "bison_parser.cc"
    break;

  case 255:
#line 1119 "bison_parser.y"
        { (yyval.datetime_field) = kDatetimeMonth; }
#line 5009 "bison_parser.cc"
    break;

  case 256:
#line 1120 "bison_parser.y"
       { (yyval.datetime_field) = kDatetimeYear; }
#line 5015 "bison_parser.cc"
    break;

  case 257:
#line 1122 "bison_parser.y"
                                { (yyval.datetime_field) = kDatetimeSecond; }
#line 5021 "bison_parser.cc"
    break;

  case 258:
#line 1123 "bison_parser.y"
          { (yyval.datetime_field) = kDatetimeMinute; }
#line 5027 "bison_parser.cc"
    break;

  case 259:
#line 1124 "bison_parser.y"
        { (yyval.datetime_field) = kDatetimeHour; }
#line 5033 "bison_parser.cc"
    break;

  case 260:
#line 1125 "bison_parser.y"
       { (yyval.datetime_field) = kDatetimeDay; }
#line 5039 "bison_parser.cc"
    break;

  case 261:
#line 1126 "bison_parser.y"
         { (yyval.datetime_field) = kDatetimeMonth; }
#line 5045 "bison_parser.cc"
    break;

  case 262:
#line 1127 "bison_parser.y"
        { (yyval.datetime_field) = kDatetimeYear; }
#line 5051 "bison_parser.cc"
    break;

  case 265:
#line 1131 "bison_parser.y"
                                     { (yyval.expr) = Expr::makeArray((yyvsp[-1].expr_vec)); }
#line 5057 "bison_parser.cc"
    break;

  case 266:
#line 1133 "bison_parser.y"
                                          { (yyval.expr) = Expr::makeArrayIndex((yyvsp[-3].expr), (yyvsp[-1].expr)->ival); }
#line 5063 "bison_parser.cc"
    break;

  case 267:
#line 1135 "bison_parser.y"
                                                   { (yyval.expr) = Expr::makeBetween((yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
#line 5069 "bison_parser.cc"
    break;

  case 268:
#line 1137 "bison_parser.y"
                         { (yyval.expr) = Expr::makeColumnRef((yyvsp[0].sval)); }
#line 5075 "bison_parser.cc"
    break;

  case 269:
#line 1138 "bison_parser.y"
                            { (yyval.expr) = Expr::makeColumnRef((yyvsp[-2].sval), (yyvsp[0].sval)); }
#line 5081 "bison_parser.cc"
    break;

  case 270:
#line 1139 "bison_parser.y"
      { (yyval.expr) = Expr::makeStar(); }
#line 5087 "bison_parser.cc"
    break;

  case 271:
#line 1140 "bison_parser.y"
                     { (yyval.expr) = Expr::makeStar((yyvsp[-2].sval)); }
#line 5093 "bison_parser.cc"
    break;

  case 279:
#line 1144 "bison_parser.y"
                        { (yyval.expr) = Expr::makeLiteral((yyvsp[0].sval)); }
#line 5099 "bison_parser.cc"
    break;

  case 280:
#line 1146 "bison_parser.y"
                    { (yyval.expr) = Expr::makeLiteral(true); }
#line 5105 "bison_parser.cc"
    break;

  case 281:
#line 1147 "bison_parser.y"
        { (yyval.expr) = Expr::makeLiteral(false); }
#line 5111 "bison_parser.cc"
    break;

  case 282:
#line 1149 "bison_parser.y"
                       { (yyval.expr) = Expr::makeLiteral((yyvsp[0].fval)); }
#line 5117 "bison_parser.cc"
    break;

  case 284:
#line 1152 "bison_parser.y"
                     { (yyval.expr) = Expr::makeLiteral((yyvsp[0].ival)); }
#line 5123 "bison_parser.cc"
    break;

  case 285:
#line 1154 "bison_parser.y"
                    { (yyval.expr) = Expr::makeNullLiteral(); }
#line 5129 "bison_parser.cc"
    break;

  case 286:
#line 1156 "bison_parser.y"
                           {
  int day{0}, month{0}, year{0}, chars_parsed{0};
  // If the whole string is parsed, chars_parsed points to the terminating null byte after the last character
  if (sscanf((yyvsp[0].sval), "%4d-%2d-%2d%n", &day, &month, &year, &chars_parsed) != 3 || (yyvsp[0].sval)[chars_parsed] != 0) {
    free((yyvsp[0].sval));
    yyerror(&yyloc, result, scanner, "Found incorrect date format. Expected format: YYYY-MM-DD");
    YYERROR;
  }
  (yyval.expr) = Expr::makeDateLiteral((yyvsp[0].sval));
}
#line 5144 "bison_parser.cc"
    break;

  case 287:
#line 1167 "bison_parser.y"
                                         { (yyval.expr) = Expr::makeIntervalLiteral((yyvsp[-1].ival), (yyvsp[0].datetime_field)); }
#line 5150 "bison_parser.cc"
    break;

  case 288:
#line 1168 "bison_parser.y"
                                 {
  int duration{0}, chars_parsed{0};
  // If the whole string is parsed, chars_parsed points to the terminating null byte after the last character
  if (sscanf((yyvsp[-1].sval), "%d%n", &duration, &chars_parsed) != 1 || (yyvsp[-1].sval)[chars_parsed] != 0) {
    free((yyvsp[-1].sval));
    yyerror(&yyloc, result, scanner, "Found incorrect interval format. Expected format: INTEGER");
    YYERROR;
  }
  free((yyvsp[-1].sval));
  (yyval.expr) = Expr::makeIntervalLiteral(duration, (yyvsp[0].datetime_field));
}
#line 5166 "bison_parser.cc"
    break;

  case 289:
#line 1179 "bison_parser.y"
                  {
  int duration{0}, chars_parsed{0};
  // 'seconds' and 'minutes' are the longest accepted interval qualifiers (7 chars) + null byte
  char unit_string[8];
  // If the whole string is parsed, chars_parsed points to the terminating null byte after the last character
  if (sscanf((yyvsp[0].sval), "%d %7s%n", &duration, unit_string, &chars_parsed) != 2 || (yyvsp[0].sval)[chars_parsed] != 0) {
    free((yyvsp[0].sval));
    yyerror(&yyloc, result, scanner, "Found incorrect interval format. Expected format: INTEGER INTERVAL_QUALIIFIER");
    YYERROR;
  }
  free((yyvsp[0].sval));

  DatetimeField unit;
  if (strcasecmp(unit_string, "second") == 0 || strcasecmp(unit_string, "seconds") == 0) {
    unit = kDatetimeSecond;
  } else if (strcasecmp(unit_string, "minute") == 0 || strcasecmp(unit_string, "minutes") == 0) {
    unit = kDatetimeMinute;
  } else if (strcasecmp(unit_string, "hour") == 0 || strcasecmp(unit_string, "hours") == 0) {
    unit = kDatetimeHour;
  } else if (strcasecmp(unit_string, "day") == 0 || strcasecmp(unit_string, "days") == 0) {
    unit = kDatetimeDay;
  } else if (strcasecmp(unit_string, "month") == 0 || strcasecmp(unit_string, "months") == 0) {
    unit = kDatetimeMonth;
  } else if (strcasecmp(unit_string, "year") == 0 || strcasecmp(unit_string, "years") == 0) {
    unit = kDatetimeYear;
  } else {
    yyerror(&yyloc, result, scanner, "Interval qualifier is unknown.");
    YYERROR;
  }
  (yyval.expr) = Expr::makeIntervalLiteral(duration, unit);
}
#line 5202 "bison_parser.cc"
    break;

  case 290:
#line 1211 "bison_parser.y"
                 {
  (yyval.expr) = Expr::makeParameter(yylloc.total_column);
  (yyval.expr)->ival2 = yyloc.param_list.size();
  yyloc.param_list.push_back((yyval.expr));
}
#line 5212 "bison_parser.cc"
    break;

  case 292:
#line 1220 "bison_parser.y"
                                                                        {
  (yyvsp[-2].table_vec)->push_back((yyvsp[0].table));
  auto tbl = new TableRef(kTableCrossProduct);
  tbl->list = (yyvsp[-2].table_vec);
  (yyval.table) = tbl;
}
#line 5223 "bison_parser.cc"
    break;

  case 296:
#line 1229 "bison_parser.y"
                                                                                     {
  auto tbl = new TableRef(kTableSelect);
  tbl->select = (yyvsp[-2].select_stmt);
  tbl->alias = (yyvsp[0].alias_t);
  (yyval.table) = tbl;
}
#line 5234 "bison_parser.cc"
    break;

  case 297:
#line 1236 "bison_parser.y"
                                       {
  (yyval.table_vec) = new std::vector<TableRef*>();
  (yyval.table_vec)->push_back((yyvsp[0].table));
}
#line 5243 "bison_parser.cc"
    break;

  case 298:
#line 1240 "bison_parser.y"
                                           {
  (yyvsp[-2].table_vec)->push_back((yyvsp[0].table));
  (yyval.table_vec) = (yyvsp[-2].table_vec);
}
#line 5252 "bison_parser.cc"
    break;

  case 299:
#line 1245 "bison_parser.y"
                                            {
  auto tbl = new TableRef(kTableName);
  tbl->schema = (yyvsp[-1].table_name).schema;
  tbl->name = (yyvsp[-1].table_name).name;
  tbl->alias = (yyvsp[0].alias_t);
  (yyval.table) = tbl;
}
#line 5264 "bison_parser.cc"
    break;

  case 300:
#line 1253 "bison_parser.y"
                                     {
  (yyval.table) = new TableRef(kTableName);
  (yyval.table)->schema = (yyvsp[0].table_name).schema;
  (yyval.table)->name = (yyvsp[0].table_name).name;
}
#line 5274 "bison_parser.cc"
    break;

  case 301:
#line 1259 "bison_parser.y"
                        {
  (yyval.table_name).schema = nullptr;
  (yyval.table_name).name = (yyvsp[0].sval);
}
#line 5283 "bison_parser.cc"
    break;

  case 302:
#line 1263 "bison_parser.y"
                            {
  (yyval.table_name).schema = (yyvsp[-2].sval);
  (yyval.table_name).name = (yyvsp[0].sval);
}
#line 5292 "bison_parser.cc"
    break;

  case 303:
#line 1268 "bison_parser.y"
                            { (yyval.sval) = (yyvsp[0].sval); }
#line 5298 "bison_parser.cc"
    break;

  case 304:
#line 1269 "bison_parser.y"
              { (yyval.sval) = nullptr; }
#line 5304 "bison_parser.cc"
    break;

  case 306:
#line 1271 "bison_parser.y"
                                                            { (yyval.alias_t) = new Alias((yyvsp[-3].sval), (yyvsp[-1].str_vec)); }
#line 5310 "bison_parser.cc"
    break;

  case 308:
#line 1273 "bison_parser.y"
                                            { (yyval.alias_t) = nullptr; }
#line 5316 "bison_parser.cc"
    break;

  case 309:
#line 1275 "bison_parser.y"
                      { (yyval.alias_t) = new Alias((yyvsp[0].sval)); }
#line 5322 "bison_parser.cc"
    break;

  case 310:
#line 1276 "bison_parser.y"
             { (yyval.alias_t) = new Alias((yyvsp[0].sval)); }
#line 5328 "bison_parser.cc"
    break;

  case 312:
#line 1278 "bison_parser.y"
                                { (yyval.alias_t) = nullptr; }
#line 5334 "bison_parser.cc"
    break;

  case 313:
#line 1284 "bison_parser.y"
                                             { (yyval.locking_clause_vec) = (yyvsp[0].locking_clause_vec); }
#line 5340 "bison_parser.cc"
    break;

  case 314:
#line 1285 "bison_parser.y"
              { (yyval.locking_clause_vec) = nullptr; }
#line 5346 "bison_parser.cc"
    break;

  case 315:
#line 1287 "bison_parser.y"
                                         {
  (yyval.locking_clause_vec) = new std::vector<LockingClause*>();
  (yyval.locking_clause_vec)->push_back((yyvsp[0].locking_t));
}
#line 5355 "bison_parser.cc"
    break;

  case 316:
#line 1291 "bison_parser.y"
                                         {
  (yyvsp[-1].locking_clause_vec)->push_back((yyvsp[0].locking_t));
  (yyval.locking_clause_vec) = (yyvsp[-1].locking_clause_vec);
}
#line 5364 "bison_parser.cc"
    break;

  case 317:
#line 1296 "bison_parser.y"
                                                       {
  (yyval.locking_t) = new LockingClause();
  (yyval.locking_t)->rowLockMode = (yyvsp[-1].lock_mode_t);
  (yyval.locking_t)->rowLockWaitPolicy = (yyvsp[0].lock_wait_policy_t);
  (yyval.locking_t)->tables = nullptr;
}
#line 5375 "bison_parser.cc"
    break;

  case 318:
#line 1302 "bison_parser.y"
                                                           {
  (yyval.locking_t) = new LockingClause();
  (yyval.locking_t)->rowLockMode = (yyvsp[-3].lock_mode_t);
  (yyval.locking_t)->tables = (yyvsp[-1].str_vec);
  (yyval.locking_t)->rowLockWaitPolicy = (yyvsp[0].lock_wait_policy_t);
}
#line 5386 "bison_parser.cc"
    break;

  case 319:
#line 1309 "bison_parser.y"
                       { (yyval.lock_mode_t) = RowLockMode::ForUpdate; }
#line 5392 "bison_parser.cc"
    break;

  case 320:
#line 1310 "bison_parser.y"
                { (yyval.lock_mode_t) = RowLockMode::ForNoKeyUpdate; }
#line 5398 "bison_parser.cc"
    break;

  case 321:
#line 1311 "bison_parser.y"
        { (yyval.lock_mode_t) = RowLockMode::ForShare; }
#line 5404 "bison_parser.cc"
    break;

  case 322:
#line 1312 "bison_parser.y"
            { (yyval.lock_mode_t) = RowLockMode::ForKeyShare; }
#line 5410 "bison_parser.cc"
    break;

  case 323:
#line 1314 "bison_parser.y"
                                  { (yyval.lock_wait_policy_t) = RowLockWaitPolicy::SkipLocked; }
#line 5416 "bison_parser.cc"
    break;

  case 324:
#line 1315 "bison_parser.y"
         { (yyval.lock_wait_policy_t) = RowLockWaitPolicy::NoWait; }
#line 5422 "bison_parser.cc"
    break;

  case 325:
#line 1316 "bison_parser.y"
              { (yyval.lock_wait_policy_t) = RowLockWaitPolicy::None; }
#line 5428 "bison_parser.cc"
    break;

  case 327:
#line 1322 "bison_parser.y"
                                            { (yyval.with_description_vec) = nullptr; }
#line 5434 "bison_parser.cc"
    break;

  case 328:
#line 1324 "bison_parser.y"
                                         { (yyval.with_description_vec) = (yyvsp[0].with_description_vec); }
#line 5440 "bison_parser.cc"
    break;

  case 329:
#line 1326 "bison_parser.y"
                                         {
  (yyval.with_description_vec) = new std::vector<WithDescription*>();
  (yyval.with_description_vec)->push_back((yyvsp[0].with_description_t));
}
#line 5449 "bison_parser.cc"
    break;

  case 330:
#line 1330 "bison_parser.y"
                                             {
  (yyvsp[-2].with_description_vec)->push_back((yyvsp[0].with_description_t));
  (yyval.with_description_vec) = (yyvsp[-2].with_description_vec);
}
#line 5458 "bison_parser.cc"
    break;

  case 331:
#line 1335 "bison_parser.y"
                                                   {
  (yyval.with_description_t) = new WithDescription();
  (yyval.with_description_t)->alias = (yyvsp[-2].sval);
  (yyval.with_description_t)->select = (yyvsp[0].select_stmt);
}
#line 5468 "bison_parser.cc"
    break;

  case 332:
#line 1345 "bison_parser.y"
                                                                     {
  (yyval.table) = new TableRef(kTableJoin);
  (yyval.table)->join = new JoinDefinition();
  (yyval.table)->join->type = kJoinNatural;
  (yyval.table)->join->left = (yyvsp[-3].table);
  (yyval.table)->join->right = (yyvsp[0].table);
}
#line 5480 "bison_parser.cc"
    break;

  case 333:
#line 1352 "bison_parser.y"
                                                                         {
  (yyval.table) = new TableRef(kTableJoin);
  (yyval.table)->join = new JoinDefinition();
  (yyval.table)->join->type = (JoinType)(yyvsp[-4].join_type);
  (yyval.table)->join->left = (yyvsp[-5].table);
  (yyval.table)->join->right = (yyvsp[-2].table);
  (yyval.table)->join->condition = (yyvsp[0].expr);
}
#line 5493 "bison_parser.cc"
    break;

  case 334:
#line 1360 "bison_parser.y"
                                                                                     {
  (yyval.table) = new TableRef(kTableJoin);
  (yyval.table)->join = new JoinDefinition();
  (yyval.table)->join->type = (yyvsp[-6].join_type);
  (yyval.table)->join->left = (yyvsp[-7].table);
  (yyval.table)->join->right = (yyvsp[-4].table);
  (yyval.table)->join->namedColumns = (yyvsp[-1].str_vec);
}
#line 5506 "bison_parser.cc"
    break;

  case 335:
#line 1369 "bison_parser.y"
                      { (yyval.join_type) = kJoinInner; }
#line 5512 "bison_parser.cc"
    break;

  case 336:
#line 1370 "bison_parser.y"
             { (yyval.join_type) = kJoinLeft; }
#line 5518 "bison_parser.cc"
    break;

  case 337:
#line 1371 "bison_parser.y"
       { (yyval.join_type) = kJoinLeft; }
#line 5524 "bison_parser.cc"
    break;

  case 338:
#line 1372 "bison_parser.y"
              { (yyval.join_type) = kJoinRight; }
#line 5530 "bison_parser.cc"
    break;

  case 339:
#line 1373 "bison_parser.y"
        { (yyval.join_type) = kJoinRight; }
#line 5536 "bison_parser.cc"
    break;

  case 340:
#line 1374 "bison_parser.y"
             { (yyval.join_type) = kJoinFull; }
#line 5542 "bison_parser.cc"
    break;

  case 341:
#line 1375 "bison_parser.y"
        { (yyval.join_type) = kJoinFull; }
#line 5548 "bison_parser.cc"
    break;

  case 342:
#line 1376 "bison_parser.y"
       { (yyval.join_type) = kJoinFull; }
#line 5554 "bison_parser.cc"
    break;

  case 343:
#line 1377 "bison_parser.y"
        { (yyval.join_type) = kJoinCross; }
#line 5560 "bison_parser.cc"
    break;

  case 344:
#line 1378 "bison_parser.y"
                       { (yyval.join_type) = kJoinInner; }
#line 5566 "bison_parser.cc"
    break;

  case 348:
#line 1389 "bison_parser.y"
                             {
  (yyval.str_vec) = new std::vector<char*>();
  (yyval.str_vec)->push_back((yyvsp[0].sval));
}
#line 5575 "bison_parser.cc"
    break;

  case 349:
#line 1393 "bison_parser.y"
                                 {
  (yyvsp[-2].str_vec)->push_back((yyvsp[0].sval));
  (yyval.str_vec) = (yyvsp[-2].str_vec);
}
#line 5584 "bison_parser.cc"
    break;


#line 5588 "bison_parser.cc"

      default: break;
    }
  /* User semantic actions sometimes alter yychar, and that requires
     that yytoken be updated with the new translation.  We take the
     approach of translating immediately before every use of yytoken.
     One alternative is translating here after every semantic action,
     but that translation would be missed if the semantic action invokes
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
     incorrect destructor might then be invoked immediately.  In the
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
     to an incorrect destructor call or verbose syntax error message
     before the lookahead is translated.  */
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;
  *++yylsp = yyloc;

  /* Now 'shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */
  {
    const int yylhs = yyr1[yyn] - YYNTOKENS;
    const int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }

  goto yynewstate;


/*--------------------------------------.
| yyerrlab -- here on detecting error.  |
`--------------------------------------*/
yyerrlab:
  /* Make sure we have latest lookahead translation.  See comments at
     user semantic actions for why this is necessary.  */
  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);

  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if ! YYERROR_VERBOSE
      yyerror (&yylloc, result, scanner, YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
                                        yyssp, yytoken)
      {
        char const *yymsgp = YY_("syntax error");
        int yysyntax_error_status;
        yysyntax_error_status = YYSYNTAX_ERROR;
        if (yysyntax_error_status == 0)
          yymsgp = yymsg;
        else if (yysyntax_error_status == 1)
          {
            if (yymsg != yymsgbuf)
              YYSTACK_FREE (yymsg);
            yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
            if (!yymsg)
              {
                yymsg = yymsgbuf;
                yymsg_alloc = sizeof yymsgbuf;
                yysyntax_error_status = 2;
              }
            else
              {
                yysyntax_error_status = YYSYNTAX_ERROR;
                yymsgp = yymsg;
              }
          }
        yyerror (&yylloc, result, scanner, yymsgp);
        if (yysyntax_error_status == 2)
          goto yyexhaustedlab;
      }
# undef YYSYNTAX_ERROR
#endif
    }

  yyerror_range[1] = yylloc;

  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */

      if (yychar <= YYEOF)
        {
          /* Return failure if at end of input.  */
          if (yychar == YYEOF)
            YYABORT;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval, &yylloc, result, scanner);
          yychar = YYEMPTY;
        }
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:
  /* Pacify compilers when the user code never invokes YYERROR and the
     label yyerrorlab therefore never appears in user code.  */
  if (0)
    YYERROR;

  /* Do not reclaim the symbols of the rule whose action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (!yypact_value_is_default (yyn))
        {
          yyn += YYTERROR;
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
        YYABORT;

      yyerror_range[1] = *yylsp;
      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp, yylsp, result, scanner);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END

  yyerror_range[2] = yylloc;
  /* Using YYLLOC is tempting, but would change the location of
     the lookahead.  YYLOC is available though.  */
  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
  *++yylsp = yyloc;

  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;


/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;


#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (&yylloc, result, scanner, YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
#endif


/*-----------------------------------------------------.
| yyreturn -- parsing is finished, return the result.  |
`-----------------------------------------------------*/
yyreturn:
  if (yychar != YYEMPTY)
    {
      /* Make sure we have latest lookahead translation.  See comments at
         user semantic actions for why this is necessary.  */
      yytoken = YYTRANSLATE (yychar);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval, &yylloc, result, scanner);
    }
  /* Do not reclaim the symbols of the rule whose action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  yystos[+*yyssp], yyvsp, yylsp, result, scanner);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  return yyresult;
}
#line 1399 "bison_parser.y"


/*********************************
 ** Section 4: Additional C code
 *********************************/

/* empty */

    // clang-format on
